-
Notifications
You must be signed in to change notification settings - Fork 133
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
MQTT Pushes for Form Updates #866
Comments
Blocking questions:
Non-blocking questions:
CC @ukanga @denniswambua any more questions scenarios you can think of? |
@pld Here you go:
"How should we configure the MQTT server that the API pushes updates to? Are all updates pushed to the same MQTT server, would the server ever be different depending on the user/form/server/cluster? Will we ever need to hot-swap the MQTT server without a server restart?"
"How is the message_id set"
"What content builds the hash?
"Do we want to use MQTT for other messaging/queueing now or in the future?"
"Is there a canonical python library we want to use for this?"
|
The push should also fire when linked datasets are updated. I've updated my initial comment with this. |
I was discussing this quickly with Jason, and it would be good to add the ability to notify the user to a form update if any linked datasets (e.g. pull csv, linked dataset, media, etc.) was changed. |
There has been work already done as regards publishing messages to MQTT here #1288. The root topics there are:
However, the topics' definition in the above work doesn't follow the hierarchy of objects in Onadata. i.e, Organisations have Projects, and Projects have XForms, and XForms have Submission. Following discussions with @ukanga , the hierarchy of the topic definitions needs to be made in such a way that allows more flexibility. An example topic would be: In such, there's flexibility in narrowing down or widening what to listen to by using a single topic root. |
Is there a reason we may want namespaces for topics? Like sharing the MQTT service between different implementations and services? Such that we do
|
Yes. The service might be shared and it would be great to have. |
I think with the namespace, your proposal will be good to go. I would expect we will still maintain the previous topics, perhaps have them on a depreciation path. |
Add support for pushing form updates and free form messages to MQTT.
Form Schema Updates
These updates correspond to changes in XForms forms within Onadata. Form actions that qualify as schema updates include:
An MQTT payload for this type of update should look like:
Payloads can be pushed to one of the following topics, depending on the action:
onadata/users/jrogena/forms/153798/schema/published
onadata/users/jrogena/forms/153798/schema/updated
onadata/users/jrogena/forms/153798/schema/unpublished
The topics follow the following syntax:
Topics can contain up to 32,767 UTF-8 (no other character encoding supported) characters. Note the use of verbs (in past tense) in the lowest bit of the topics. My way of showing that final topic level represent an action (and not an object). Higher topic levels should represent objects.
Free Form Message Updates
These updates correspond to actions on user-defined messages published on Ona. Free form messages will only be tied to forms (users should be able to send free-form messages relating to forms). I, however, anticipate that in future this type of message could be tied to other Ona object types (orgs, users, projects e.t.c.).
An MQTT payload for this type of update should look like:
The value for the
payload.message
JSON key can contain up to 65,536 Unicode characters.Payloads can be pushed to one of the following topics, depending on the action:
onadata/users/jrogena/forms/153798/messages/ddd39f09fbfc38766de5cc01ddc5e6c4/published
onadata/users/jrogena/forms/153798/messages/ddd39f09fbfc38766de5cc01ddc5e6c4/updated
onadata/users/jrogena/forms/153798/messages/ddd39f09fbfc38766de5cc01ddc5e6c4/unpublished
The topics follow the following syntax:
Topics can contain up to 32,767 UTF-8 (no other character encoding supported) characters. Note the use of verbs (in past tense) in the lowest bit of the topics. My way of showing that final topic level represent an action (and not an object). Higher topic levels should represent objects.
The text was updated successfully, but these errors were encountered: