This method is called when the
updateListeners()method needs a message to send to subscribed Actors.
This method is called when the
updateListeners()method needs a message to send to subscribed Actors. In particular, createUpdate is used to create the first message that a newly subscribed CometListener will receive.
updateListeners() needs a message to send to subscribed Actors. In particular, createUpdate is used to create the first message that a newly subscribed CometListener will receive.
Override this method to process high priority messages.
Override this method to process high priority messages. Note: you must not process messages with a wildcard (match all), since this will intercept the messages used for subscription control.
Override this method to process low priority messages.
Override this method to process low priority messages.
Override this method to process medium priority messages.
Override this method to process medium priority messages. See the highPriority method for an important note on wildcard processing.
#highPriority
Called after RemoveAListener-message is processed and no more listeners exist.
Called after RemoveAListener-message is processed and no more listeners exist. Default does nothing.
Send a message we create to all of the listeners.
Send a message we create to all of the listeners. Note that with this invocation the createUpdate method is not used.
Update the listeners with the message generated by createUpdate
Update the listeners with the message generated by createUpdate
This trait manages a set of Actors in a publish/subscribe pattern. When you extend your Actor with this trait, you automatically get handling for sending messages out to all subscribed Actors. Simply override the high-, medium-, or lowPriority handlers to do your message processing. When you want to update all subscribers, just call the updateListeners method. The createUpdate method is used to generate the message that you want sent to all subscribers.
Note that the AddAListener and RemoveAListener messages (for subscription control) are processed after any highPriority or mediumPriority messages are processed, so take care to avoid overly broad matches in those handlers that might consume internal messages.
For example, you could write a simple service to provide clock ticks using the following code:
A client CometActor could look like:
CometListener