-
Notifications
You must be signed in to change notification settings - Fork 100
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
Upon subscribe, receive last event published #69
Comments
The router needs to remember the last event published to some topic in memory. When a client subscribes to the topic with the option A router may provide means to configure whether a given URI or set of URIs should be enabled for storing the last event published to a topic with an URI matching. |
I feel this empty payload message should be optional, otherwise it'd force clients to handle empty payloads even if they can possibly live without that message. Note: I also think that in some cases users could also prefer to add their own attributes to that message, so I feel this feature would be better handled by, or complimented by an "interceptor" feature as suggested at https://groups.google.com/forum/#!topic/crossbario/LbfbxnSd5YA . |
I may be misunderstanding the scenario, but I think the right way to do this would be to subscribe to any events before triggering something would send events. Sending the last event seems like a bad idea to me. |
Sure - if it is possible in the app. This feature is more about a client late joining the party. E.g. subscribe to a sensor event, but the sensor was already running when subscribing. Gimme the last event that was published to the topic automatically when subscribing comes in handy.. |
In our app, the client uses a |
Sending the last events doesn't give you any confidence you received all the events you need. What if there were more than one event sent between when you wanted the events and when the subscription actually got registered? Also, what if no event has been sent yet? Then you have an inconsistency where sometimes event listeners have to ignore the first event they get, and sometimes they have to pay attention to it. This will make it much more error prone to write handlers like this. In short, sending the previous event is both inconsistent and inadequate. Its not a good solution. The appropriate way to deal with this is to have some kind of timestamp the client sends, indicating that all the events after that timestamp should be sent to it. This is yet another reason to allow arguments to be passed in a call to |
Also, this behavior is not appropriate to put into a messaging protocol. This is delving into what messages get sent. It should be entirely up to the application logic what messages get sent and when they get sent. The protocol has no business defining this. |
While I see the usecase (we faced the same issues ourselves), I also think, that this should not be part of the protocol itself. |
Closing as implementation defined. Eg Crossbar.io supports both event history and retained messages. |
This On the other side, Event history is more generic but also way more complex feature. It is also harder to use for observer to retrieve initial state topic. For reference, MQTT supports |
Say we are subscribed to
on_worker_starting
. Upon receiving that event, we are immediately subscribing toon_worker_component_starting
.Fine. However, the component within the worker might get started (and hence the
on_worker_component_starting
published) fast than we are able to subscribe. Then we "miss" the event.The text was updated successfully, but these errors were encountered: