|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.engine.mime.demo.PublishDelayer
public class PublishDelayer
This demo plugin delays incoming (published) messages. You can also provide for example an exceptionErrorCode=internal.publish and each message will throw such an exception (usually for testing).
Please register this plugin in xmlBlaster.propertiesMimePublishPlugin[TestDelayer][1.0]=org.xmlBlaster.engine.mime.demo.PublishDelayer,delayMillis=200,exceptionErrorCode=,filterKeyOid=Plugins must implement the I_Plugin interface to be loadable by the PluginManager and must implement the I_PublishFilter interface to be usable as a filter.
Field Summary | |
---|---|
private ContextNode |
contextNode
|
private long |
delayMillis
How long to delay an incoming publish message |
private java.lang.String |
exceptionErrorCode
|
private java.lang.String |
filterKeyOid
|
private Global |
glob
|
private static java.util.logging.Logger |
log
|
private java.lang.Object |
mbeanHandle
My JMX registration |
private java.lang.String |
ME
|
private PluginInfo |
pluginConfig
|
Constructor Summary | |
---|---|
PublishDelayer()
|
Method Summary | |
---|---|
long |
getDelayMillis()
|
java.lang.String |
getExceptionErrorCode()
|
java.lang.String |
getFilterKeyOid()
|
java.lang.String[] |
getMimeExtended()
Get the content MIME version number for which this plugin applies |
java.lang.String[] |
getMimeTypes()
Get the content MIME type for which this plugin applies |
java.lang.String |
getName()
Get a human readable name of this filter implementation |
java.lang.String |
getType()
|
java.lang.String |
getVersion()
|
void |
init(Global glob,
PluginInfo pluginInfo)
This method is called by the PluginManager (enforced by I_Plugin). |
void |
initialize(ServerScope serverScope)
This is called after instantiation of the plugin |
java.lang.String |
intercept(SubjectInfo publisher,
MsgUnit msgUnit)
Delay the message for the configured amount of time. |
void |
setDelayMillis(long delayMillis)
|
void |
setExceptionErrorCode(java.lang.String exceptionErrorCode)
By setting an errorCode String != "" the published message is rejected with the given exception type. |
void |
setFilterKeyOid(java.lang.String filterKeyOid)
By setting a topicId != "" the plugin is only applied for the given messages oid. |
void |
shutdown()
Cleans up the resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String ME
private Global glob
private java.lang.Object mbeanHandle
private ContextNode contextNode
private PluginInfo pluginConfig
private static java.util.logging.Logger log
private long delayMillis
private java.lang.String exceptionErrorCode
private java.lang.String filterKeyOid
Constructor Detail |
---|
public PublishDelayer()
Method Detail |
---|
public void initialize(ServerScope serverScope)
initialize
in interface I_PublishFilter
glob
- The global handle of this xmlBlaster server instance.public void init(Global glob, PluginInfo pluginInfo) throws XmlBlasterException
init
in interface I_Plugin
XmlBlasterException
I_Plugin.init(org.xmlBlaster.util.Global,org.xmlBlaster.util.plugin.PluginInfo)
public java.lang.String getType()
getType
in interface I_Plugin
I_Plugin.getType()
public java.lang.String getVersion()
getVersion
in interface I_Plugin
I_Plugin.getVersion()
public java.lang.String getName()
getName
in interface I_PublishFilter
public java.lang.String[] getMimeTypes()
getMimeTypes
in interface I_PublishFilter
public java.lang.String[] getMimeExtended()
getMimeExtended
in interface I_PublishFilter
public java.lang.String intercept(SubjectInfo publisher, MsgUnit msgUnit) throws XmlBlasterException
intercept
in interface I_PublishFilter
publisher
- The subject object describing the publishermsgUnit
- The message to check
XmlBlasterException
- Is thrown on problems, for example if the MIME type
does not fit to message content.I_PublisheFilter#intercept(SubjectInfo, MsgUnit)
public void shutdown()
I_Plugin
shutdown
in interface I_PublishFilter
shutdown
in interface I_Plugin
public long getDelayMillis()
getDelayMillis
in interface PublishDelayerMBean
public void setDelayMillis(long delayMillis)
setDelayMillis
in interface PublishDelayerMBean
public java.lang.String getExceptionErrorCode()
getExceptionErrorCode
in interface PublishDelayerMBean
public void setExceptionErrorCode(java.lang.String exceptionErrorCode)
setExceptionErrorCode
in interface PublishDelayerMBean
exceptionErrorCode
- e.g. "internal.publish" to be thrownErrorCode
public java.lang.String getFilterKeyOid()
getFilterKeyOid
in interface PublishDelayerMBean
public void setFilterKeyOid(java.lang.String filterKeyOid)
setFilterKeyOid
in interface PublishDelayerMBean
filterKeyOid
- e.g. "Hello" to only slow down "Hello" messages, others are ignoredErrorCode
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |