-
Notifications
You must be signed in to change notification settings - Fork 22
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 Rabbitmq´s MQTT plugin #227
Comments
Haven´t mentioned it yet, but obviously, the target rabbitmq broker must have mqtt plugin enabled and configured to match the settings above. Then something published on amqp as:
|
Once we can publish for MQTT subscribers, a little additional work would be needed to enable a foreign (non-sarracenia) MQTT client could publish to the hierarchy on the rabbitmq broker, and sarracenia could subscribe via amqp without modification... I think all we need is:
and the sarracenia consumer, will know to take the first topic, and pretend that is an exchange, reversing the transformation above. |
so with three options, and some small tweaks in message parsing, we could get likely one model of mqtt interop working. |
Perhaps this is sufficiently confusing that we should write the documentation first? no... has to be written after because examples... can´t be written until the code exists... ok never mind. |
Note1: All I have for now about this issue are questions :
In brief, I would like to get some feedback from Sarra users (mostly analyst?) about their feeling on providing 2 solutions (#128 and #227) to one problem adding multiple new configurations ? Note2: I want to provide a diagram of an overview of this current use case, I will work on this today. |
review of offline chat with @benlapETS :
|
Note1: The right procedure would be to tag as EXPERIMENTAL in the .rst files and in the appropriate man pages I guess, isnt it ? |
yes, the man pages for sure. I guess the setup instructions would go in the Admin.rst, and the something should indicate the features are experimental. |
thinking about it... I don't think we even need the rabbitmqtt_post_broker setting. We just use the ordinary post_broker, the only setting we need is rabbitmqtt_post_exchange... when set the already described transformations happen to the topic and exchange, and we just use the existing post_broker. |
Note1. Here are the detailed use cases for #227:
Note2: Questions:
|
Note 2 questions... yes if all publishing is done from Sarracenia, and mqtt is only a consumer, then it doesn''t make much sense to consume from mqtt. I'm not entirely sure of the permission model. After we have done the first iteration, we may find different use cases, where we allow MQTT users to publish to the mqtt side of the broker, and we want to forward to others. The other, much simpler/obvious use case is for loopback testing with rabbitmqtt_post_broker which would likely be a good thing to add as a flow_test. chain (add rabbitmqtt plugin on flow test, publish and then consume through it.) We won't have a Sarracenia MQTT consumer until #128 is done, but if we were only worried about Sarracenia, then there is no need for mqtt in the first place. The purpose of adding MQTT is to demonstrate interop with other implementations... we could try it with the https://github.com/MetPX/wmo_mesh/ project as a sample consumer, but there are no existing implementations to interop with yet. so... The motivations are: Build it and they will come - https://www.youtube.com/watch?v=5Ay5GqJwHF8 (providing an intial reference implementation for others to work with.) Dogfooding - https://medium.com/@benbob/the-gospel-of-dogfooding-can-i-hear-an-amen-brother-1af4d82cf221 ( using it ourselves to prove it works. ) |
oh, yeah... there is another motivation for MQTT support... the dialup data acquisition (DARTS) stuff will evolve over the next few years, and there seems to be industry weight behind MQTT, so it is possible that the auto stations will produce MQTT data natively. Getting the data acquisition and exchange worlds closer together would be a good thing... but again, implementations have to exist to for people to work with. |
RequirementsGeneral:R.i227 Sarracenia must support RabbitMQ´s MQTT plugin (aka RabbitMQTT) Detailed (new or preserved):Functionnal requirements (FR):FR1 Sarracenia must provide a MQTT configuration interface that enables the uses of the RabbitMQ MQTT plugin.
FR2 Sarracenia must support MQTT through RabbitMQTT.
FR3 Sarracenia must map RabbitMQTT to normal Sarracenia usage.
Non functionnal requirements (NR)Reliability
Interoperability
Security
|
Note1: The actual configurations |
changing will break a lot... Could add an alias though... |
Note 1: I don't intend to change syntax right now, I'm just taking notes from my thoughts. I am kind of building a list of future proposition of enhancement if we make a big version change. But if your ok to add the alias right away, I will do it... |
Note 1: My last thoughts on this issue will surely change some reasoning that has already been done on MQTT support with RabbitMQTT. Having already done some experimentations using the flow test, I realized I could create a flow of MQTT data by redirecting normal AMQP exchange flow to the designated MQTT exchange of one particular broker. To do that, I used this shovel configuration, without disrupting Sarracenia code:
So, this config enabled RabbitMQTT publishing and MQTT consuming through a third-party user running mosquitto_sub. Then, to consume through Sarracenia I used this subscriber config:
These config have already been integrated to the flow test, will need to document that and then discuss on the details, if this integration suites our needs for the RabbitMQ MQTT plugin support. |
Note1: I wrote some howto doc to enable MQTT with Sarracenia, this is a first draft, but I tested it on my other machine and it worked. The only problem is that I had to authorized anonymous to have .* read permission (couldn't restrict to only x.*public). |
the name used in the howto, xmqtt_public exchange name doesn't match the required naming scheme ... which is why you needed to tweak permissions... the exchange name needs to start with xs_ and end in puiblic. Try an exchange name: xs_mqtt_public, and I imagine anonymous will be able to read it without the permission tweak. I think every sr_audit run will reset the permissions anyways... the recipe is likely very fragile as-is, it might even delete the exchange if run with the right options. The permission model (which is based on standardized name scheme for exchanges) is described here: https://github.com/MetPX/sarracenia/blob/master/doc/sr_subscribe.1.rst#naming-exchanges-and-queues and a slightly older (and conflicting... ought to fix that ;-) here: https://github.com/MetPX/sarracenia/blob/master/doc/Concepts.rst#security-considerations |
Note1: The problem is not only the exchange scheme, in order to allow Partner user subscribers (like mosquitto_sub) to a feed we should allow a different queue scheme which I don't know how to control the format (for now) and which start with mqtt-subscription. Here is how the queue naming works in the RabbitMQ MQTT plugin https://github.com/rabbitmq/rabbitmq-mqtt/blob/master/src/rabbit_mqtt_util.erl:
That means we would need Note2: For the exchange name I just thought that as we were having xpublic and xflow_public for names that we use to implement and to test public exchanges, xmqtt_public would make sense for a public mqtt exchange name. And as it would be the only mqtt exchange of a node it would make sense to use it as standard for our mqtt nodes which would make it more interoperable and less confusing then having the name of a user in it... We would also protect it the same way as xpublic. Also, you proposed the xmqtt_public name yourself in #128 Note3: As I experimented sr_audit doesn't reset permission it only creates it, unless the reset flag is set to true which is not the case in the flow test, because we uses Note4: In the branch issue227, I've already changed the code on July12 (3dce17e) so xmqtt_public was protected as xpublic is... oh yeah, forgot that, it was rabbitmqtt but changed it to xmqtt_public yesterday. I also noticed that I should've committed the doc in the branch instead of master, sorry about that it could be a bit confusing. Note5: Renamed to xs_mqtt_public (9d0e01f) we'll test with that until we discuss more about that. |
hmm... that is an issue... ok, if we need to change the permission mask, the solution is to modify sr_audit to enforce it always, and update documentation to suit. need to think about this for a while. |
ok... we discussed how you had proposed incorporating the topic prefix into the hierarchy at the end. This has the effect of putting all mqtt traffic into a single hierarchy. The reason for putting the exchange at the beginning of the tree was to be able to establish independent topic hierarchies (this things create data structures on mqtt brokers, much like exchanges on amqp ones.) so putting the exchange at the beginning spreads them out. I worry that piling everything into a single v03.post hierarchy will have adverse effects. Is this real? dunno, thinking.... |
the other worry is that there isn't any way to identify a posting (by the content itself, without knowing) that has the exchange as the first post, versus one that doesn't.... should we perhaps differentiate using v03.postx. (if it has postx, then following subtopic is an exchange id?) |
released in 2.19.09 |
Sibling enhancement to #128 rather than have Sarracenia communicate at the application level to MQTT brokers, just take advantage of the mqtt plugin built-in to rabbitmq.
Could have an option like so:
Given those settings, Sarracenia would initiate an AMQP connection to the given rabbitmq broker, and publish to the rabbitmqtt_post_exchange. the topic would be
prefixed the value of the post_exchange
So this should be easily done with a low-level tweak, perhaps in sr_message, or sr_amqp.
The text was updated successfully, but these errors were encountered: