Just a second...

Publisher notifications

A publisher is notified of certain events by certain methods on it being called. These methods can be overridden by the user to perform processing at these points as required.

By default these methods (other than those indicated) perform no processing. You do not have to override any of these methods unless you choose to. The notification methods are:

Table 1. Notification methods
initialLoad Called when the publisher is first loaded. Is typically overridden to perform any initial processing required to prepare the publisher.
publisherStarted Called after initialLoad (see startup steps).
subscription Called when a client subscribes to a topic that the publisher owns. References to the topic and the client are passed and also a flag to indicate if the topic has already been loaded by a TopicLoader. If the topic has not been loaded already, typically a publisher sends an initial load message to the client at this point. It might not be necessary to override this method if topic loaders are in use.
unsubscription Called when a client unsubscribes from a topic that the publisher owns.
messageFromClient Called when a message is received from a client. References to the message and the client are passed.
messageFromServer Called when a message is received from a server connection. References to the message and the server connection are passed.
fetchForClient Called when a client requests a fetch of the topic state for stateless topics.
messageNotAcknowledged DEPRECATED: acknowledgements have been removed and this method will not be called.
publisherStopping This is called when the publisher has been requested to stop. It gives the publisher the opportunity to tidily perform any close processing.
publisherStopped This is called after a publisher has stopped. The publisher can still be restarted (but only if isStoppable is true).
publisherRemoved This is called when a publisher is removed and provides the opportunity for final tidy up. The publisher cannot be restarted after this is called.
systemStarted This is called when the Diffusion™ system has completed loading and is ready to accept connections. Publishers are started before connectors, so this notification is used all Diffusion sub systems are loaded.

Publisher notification threads

To understand issues of concurrency when writing a publisher it is necessary to understand in which threads the various publisher notifications occur.

When a message or request is received from a client connection, the inbound thread pool is used to process it. Depending upon the number of threads in the pool this can mean that the publisher can receive such notifications concurrently.

Other notifications come from various control threads.

All of the above considerations mean that concurrency must always be taken into account in publisher code and it must be made thread safe as appropriate.