|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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(DispatchManager dispatchManager)
This is called once for each dispatch manager using this plugin. |
boolean |
doActivate(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.ArrayList |
handleNextMessages(DispatchManager dispatchManager,
java.util.ArrayList 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(DispatchManager dispatchManager,
java.lang.Throwable ex)
Invoked when the dispatching failed due to an exception. |
void |
postHandleNextMessages(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(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, toDead, toPolling |
| Method Detail |
public void initialize(Global glob,
java.lang.String typeVersion)
throws XmlBlasterException
XmlBlasterExceptionpublic void addDispatchManager(DispatchManager dispatchManager)
public boolean doActivate(DispatchManager dispatchManager)
if (dispatchManager.getDispatchConnectionsHandler().isPolling()) {
return false;
}
public java.util.ArrayList handleNextMessages(DispatchManager dispatchManager,
java.util.ArrayList 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
public void postHandleNextMessages(DispatchManager dispatchManager,
MsgUnit[] processedEntries)
throws XmlBlasterException
dispatchManager - The used dispatch manager.processedEntries - The entries which have been previously processed.
XmlBlasterException
public void shutdown(DispatchManager dispatchManager)
throws XmlBlasterException
XmlBlasterException
public void shutdown()
throws XmlBlasterException
XmlBlasterExceptionpublic boolean isShutdown()
public java.lang.String usage()
public java.lang.String toXml(java.lang.String extraOffset)
extraOffset - Indent the dump with given ASCII blanks
public void onDispatchWorkerException(DispatchManager dispatchManager,
java.lang.Throwable ex)
dispatchManager - ex -
|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||