|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface I_MsgDispatchInterceptor
The Interface allows to control how messages are sent to the remote side.
Plugins of this interface have only one instance per plugin-typeVersion for each Global scope so you can look at it like a singleton.
Method Summary | |
---|---|
void |
addDispatchManager(I_DispatchManager dispatchManager)
This is called once for each dispatch manager using this plugin. |
boolean |
doActivate(I_DispatchManager dispatchManager)
If there are new messages available in the queue, you get invoked here and are asked if you want to start a worker thread (from the thread pool) to start taking messages from the queue and send them over the remote connection. |
java.util.List<I_Entry> |
handleNextMessages(I_DispatchManager dispatchManager,
java.util.List<I_Entry> pushEntries)
If you returned true from doActivate() the worker thread will ask us to retrieve the next messages from the queue (dispatchManager.getQueue()). |
void |
initialize(Global glob,
java.lang.String typeVersion)
Is called once only after the instance is created. |
boolean |
isShutdown()
|
void |
onDispatchWorkerException(I_DispatchManager dispatchManager,
java.lang.Throwable ex)
Invoked when the dispatching failed due to an exception. |
void |
postHandleNextMessages(I_DispatchManager dispatchManager,
MsgUnit[] processedEntries)
Method invoked after having successfully sent the entries in asynchronous modus. |
void |
shutdown()
Shutdown the implementation, sync with data store |
void |
shutdown(I_DispatchManager dispatchManager)
Deregister the given dispatchManager |
java.lang.String |
toXml(java.lang.String extraOffset)
|
java.lang.String |
usage()
|
Methods inherited from interface org.xmlBlaster.util.dispatch.I_ConnectionStatusListener |
---|
toAlive, toAliveSync, toDead, toPolling |
Method Detail |
---|
void initialize(Global glob, java.lang.String typeVersion) throws XmlBlasterException
The
- configuration name under which we are loaded e.g. "Priority,1.0"
XmlBlasterException
void addDispatchManager(I_DispatchManager dispatchManager)
boolean doActivate(I_DispatchManager dispatchManager)
if (dispatchManager.getDispatchConnectionsHandler().isPolling()) { return false; }
java.util.List<I_Entry> handleNextMessages(I_DispatchManager dispatchManager, java.util.List<I_Entry> pushEntries) throws XmlBlasterException
This is where this plugin comes in action. The plugin may filter the queue entries and for example only return high priority messages
Usually you take the message out of the queue and then invoke prepareMsgsFromQueue() to filter expired messages away and do a shallow copy of the messages to avoid that changes in the messages have impact on the original messages. See the following example:
// take messages from queue (none blocking) // we take all messages with same priority as a bulk ... ArrayList entryList = dispatchManager.getQueue().peekSamePriority(-1); // filter expired entries etc. ... // you should always call this method after taking messages from queue entryList = dispatchManager.prepareMsgsFromQueue(entryList); // ... do plugin specific work ... return entryList;
pushEntries
- null: Take messages yourself from queue (async mode) If
- XmlBlasterException is thrown, dispatch of messages is stopped.
Other exceptions will lead to giving up sending messages as configured with I_MsgErrorHandler,
usually shutdown queue and sending dead messages.
XmlBlasterException
void postHandleNextMessages(I_DispatchManager dispatchManager, MsgUnit[] processedEntries) throws XmlBlasterException
dispatchManager
- The used dispatch manager.processedEntries
- The entries which have been previously processed.
XmlBlasterException
void shutdown(I_DispatchManager dispatchManager) throws XmlBlasterException
XmlBlasterException
void shutdown() throws XmlBlasterException
true:
- force shutdown, don't flush everything
XmlBlasterException
boolean isShutdown()
java.lang.String usage()
java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- Indent the dump with given ASCII blanks
void onDispatchWorkerException(I_DispatchManager dispatchManager, java.lang.Throwable ex)
dispatchManager
- ex
-
|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |