Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of AMQP 1.0 in metwork/mfdata #502

Open
matthieumarrast opened this issue Oct 9, 2024 · 6 comments
Open

Support of AMQP 1.0 in metwork/mfdata #502

matthieumarrast opened this issue Oct 9, 2024 · 6 comments
Assignees

Comments

@matthieumarrast
Copy link
Contributor

The AMQP listener plugin uses the python pika library, made for AMQP v0.9:

https://github.com/metwork-framework/mfdata/blob/master/adm/templates/plugins/amqplistener/%7B%7Bcookiecutter.name%7D%7D/bin/amqp_listener.py

pika does not support the version 1.0 of the AMQP protocol. Cf. pika/pika#950

AMQP v0.9 and v1.0 are two distinct and incompatible versions of the protocol. (cf. https://seventhstate.io/amqp-091-vs-1/)

So to embrace the AMQP v1.0 protocol in metwork, we would like to use the python library qpid/proton (https://qpid.apache.org/proton/), do you think qpid/proton can be provided by metwork ?

(in my mind the existing plugin with amqp_listener.py must not be updated as it will remains useful for users using amqp v0.9... and it's useless to make a new one for amqp v1.0, as the user can simply use the "listener" template only, and add himself its qpid/proton code)

@thebaptiste
Copy link
Contributor

thebaptiste commented Oct 10, 2024

You can easily test it by adding python-qpid-proton in your requirements-to-freeze.txt, so it's not necessary to provide it in mfext.

Since a few weeks (see master branch), all mfdata plugins have been added as templates. So for the time being there are listener and amqplistener among the templates. I think it's confusing (there is also a template mqttlistener). So I would prefer to replace them by amqp09_listener (with pika in requirements) and amqp10_listener (with python-qpid-proton in requirements). Do you agree ?

@matthieumarrast
Copy link
Contributor Author

Yes having amqp09_listener (with pika in requirements) and amqp10_listener (with python-qpid-proton in requirements) as template is a good idea ! I approve it.

So I think we gonna keep the script amqp_listener.py (using pika) in the amqp09_listener template? This script was coming from https://github.com/pika/pika/blob/main/examples/asynchronous_consumer_example.py, as mentioned in the code.

Do you think we must add the same kind of script (using python-qpid-proton) in the amqp10_listener ? (for example from code here: https://qpid.apache.org/releases/qpid-proton-0.39.0/proton/python/docs/tutorial.html)

In my mind, I think it's maybe too "intrusive" to propose code sample in these templates. In our project, the developer kept the sample and it leads to bug by using useless amqp 0.9 operations.

@thebaptiste
Copy link
Contributor

thebaptiste commented Oct 14, 2024

So I think we gonna keep the script amqp_listener.py (using pika) in the amqp09_listener template? This script was coming from https://github.com/pika/pika/blob/main/examples/asynchronous_consumer_example.py, as mentioned in the code.

I think so, unless you consider that this script creates more problems than it helps...

Do you think we must add the same kind of script (using python-qpid-proton) in the amqp10_listener ? (for example from code here: https://qpid.apache.org/releases/qpid-proton-0.39.0/proton/python/docs/tutorial.html)

In my mind, I think it's maybe too "intrusive" to propose code sample in these templates. In our project, the developer kept the sample and it leads to bug by using useless amqp 0.9 operations.

I don't know. A code sample may help the developer. May be it should be more clearly presented as an example... or maybe only a link to https://qpid.apache.org/releases/qpid-proton-0.39.0/proton/python/docs/tutorial.html is enough...

@matthieumarrast
Copy link
Contributor Author

Yes, I think we could propose the "asychronous receiver" sample from the qpid/proton tutorial but it must be plugged with the mfdata class AmqpListener(AcquisitionListener) but it seems to be a quite complex task

@thebaptiste
Copy link
Contributor

I will create the new template, but with config.ini and amqp10_listener.py almost empty.
Feel free to fill !

@thebaptiste
Copy link
Contributor

thebaptiste commented Oct 15, 2024

Look at PR #503 (to be completed... or to be taken and completed later)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants