xmlBlaster 2.2.0 API

org.xmlBlaster.engine
Class DeadMessageDumper

java.lang.Object
  extended by org.xmlBlaster.engine.DeadMessageDumper
All Implemented Interfaces:
I_Plugin

public class DeadMessageDumper
extends java.lang.Object
implements I_Plugin

Subscribes to the "__sys__deadMessage" topic and dumps the dead messages to the hard disk.

The dumped messages are xml formatted and can be resend with XmlScriptInterpreter:

 java org.xmlBlaster.Main -xmlBlaster/acceptWrongSenderAddress/joe true

 java javaclients.script.XmlScript -prepareForPublish true -session.name joe -requestFile 2004-10-23_21_25_33_39.xml
 

In the above example xmlBlaster allows 'joe' to send faked sender addresses (the original ones) with the command line parameter -xmlBlaster/acceptWrongSenderAddress/joe true.

This DeadMessageDumper plugin is started with the run level manager as configured in xmlBlasterPlugins.xml, for example:

  <plugin id='DeadMessageDumper' className='org.xmlBlaster.engine.DeadMessageDumper'>
     <action do='LOAD' onStartupRunlevel='7' sequence='1'
                          onFail='resource.configuration.pluginFailed'/>
     <action do='STOP' onShutdownRunlevel='6' sequence='1'/>
     <attribute id='loginName'>_DeadMessageDumper</attribute>
     <attribute id='password'>secret</attribute>
     <attribute id='directoryName'>/tmp</attribute>
     <attribute id='receiverSubdir'>true</attribute>
     <attribute id='forceBase64'>false</attribute>
  </plugin>
 

The directorName defaults to $HOME/tmp and foceBase64=false tries to dump the message content in human readable form (if the message dump xml syntax allows it). If the directory does not exist, it is created automatically.

We use the LOCAL protocol driver to talk to xmlBlaster, therefor this plugin works only if the client and server is in the same virtual machine (JVM).

A typical authorization line in xmlBlaster.htpasswd could be:

_DeadMessageDumper:yZfKBiZG8:connect,disconnect,subscribe(exact:__sys__deadMessage)

Author:
Marcel Ruff
See Also:
The admin.errorHandling requirement

Field Summary
private  I_XmlBlasterAccess connection
           
private  java.lang.String directoryName
           
private  boolean forceBase64
          forceBase64==false: ASCII dump for content if possible (XML embedable)
private  Global global
           
private static java.util.logging.Logger log
           
private  java.lang.String loginName
           
private static java.lang.String ME
           
private  java.lang.String password
           
private  PluginInfo pluginInfo
           
private  long pubSessionId
           
private  boolean receiverSubdir
           
 
Constructor Summary
DeadMessageDumper()
           
 
Method Summary
private  void dumpMessage(UpdateKey updateKey, byte[] content, UpdateQos updateQos)
          Dump dead message to hard disk.
 java.lang.String getType()
           
 java.lang.String getVersion()
           
 void init(Global glob, PluginInfo pluginInfo)
          Initializes the plugin
private  java.io.File initDirectory(java.io.File parent, java.lang.String propName, java.lang.String dirName)
          Returns the specified directory or null or if needed it will create one
 void shutdown()
          Shutdown the plugin
private  void subscribeToDeadMessages()
          On startup subscribe to topic __sys__deadMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME

pluginInfo

private PluginInfo pluginInfo

global

private Global global

log

private static java.util.logging.Logger log

connection

private I_XmlBlasterAccess connection

directoryName

private java.lang.String directoryName

loginName

private java.lang.String loginName

pubSessionId

private long pubSessionId

password

private java.lang.String password

forceBase64

private boolean forceBase64
forceBase64==false: ASCII dump for content if possible (XML embedable)


receiverSubdir

private boolean receiverSubdir
Constructor Detail

DeadMessageDumper

public DeadMessageDumper()
Method Detail

init

public void init(Global glob,
                 PluginInfo pluginInfo)
          throws XmlBlasterException
Initializes the plugin

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

getType

public java.lang.String getType()
Specified by:
getType in interface I_Plugin
Returns:
the plugin type, defaults to "DeadMessageDumper"
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface I_Plugin
Returns:
the plugin version, defaults to "1.0"
See Also:
I_Plugin.getVersion()

shutdown

public void shutdown()
              throws XmlBlasterException
Shutdown the plugin

Specified by:
shutdown in interface I_Plugin
Throws:
XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.

See Also:
I_Plugin.shutdown()

subscribeToDeadMessages

private void subscribeToDeadMessages()
                              throws XmlBlasterException
On startup subscribe to topic __sys__deadMessage.

Throws:
XmlBlasterException

dumpMessage

private void dumpMessage(UpdateKey updateKey,
                         byte[] content,
                         UpdateQos updateQos)
Dump dead message to hard disk. The file name is the receive timestamp of the message, for example /home/xmlblast/tmp/2004-10-23_18_52_39_87.xml


initDirectory

private java.io.File initDirectory(java.io.File parent,
                                   java.lang.String propName,
                                   java.lang.String dirName)
                            throws XmlBlasterException
Returns the specified directory or null or if needed it will create one

Parameters:
parent -
propName - For logging only
dirName -
Returns:
Throws:
XmlBlasterException

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.