xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.dbwriter
Class SqlInfoStreamPublisher

java.lang.Object
  extended by org.xmlBlaster.contrib.dbwriter.SqlInfoStreamPublisher
All Implemented Interfaces:
java.util.EventListener, I_ChangePublisher, I_ContribPlugin, org.xmlBlaster.util.I_Timeout

public class SqlInfoStreamPublisher
extends java.lang.Object
implements I_ChangePublisher, org.xmlBlaster.util.I_Timeout


Field Summary
protected  I_Update eventHandler
           
 
Constructor Summary
SqlInfoStreamPublisher()
           
 
Method Summary
 org.xmlBlaster.jms.XBSession getJmsSession()
          Only used in replication, can return null if not used.
 java.util.Set getUsedPropertyKeys()
          Gets all property keys which may be used by this object.
 void init(I_Info info_)
          After creation this method is called.
static void main(java.lang.String[] args)
           
 void parse()
           
 java.lang.String publish(java.lang.String changeKey, byte[] message, java.util.Map attrMap)
          Send the message to the MoM.
 boolean registerAlertListener(I_Update update, java.util.Map attrs)
          Register for alerts when the data source has changed.
 void shutdown()
          Cleanup resources.
 void timeout(java.lang.Object userData)
          You will be notified about the timeout through this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventHandler

protected I_Update eventHandler
Constructor Detail

SqlInfoStreamPublisher

public SqlInfoStreamPublisher()
Method Detail

parse

public void parse()
           throws java.lang.Exception
Throws:
java.lang.Exception

getJmsSession

public org.xmlBlaster.jms.XBSession getJmsSession()
Description copied from interface: I_ChangePublisher
Only used in replication, can return null if not used.

Specified by:
getJmsSession in interface I_ChangePublisher
Returns:

init

public void init(I_Info info_)
          throws java.lang.Exception
Description copied from interface: I_ChangePublisher
After creation this method is called. The plugin must register itself into global scope with info.setObject("org.xmlBlaster.contrib.dbwatcher.mom.I_ChangePublisher", this) to be available for others.

Specified by:
init in interface I_ChangePublisher
Specified by:
init in interface I_ContribPlugin
Parameters:
info_ - The configuration environment
Throws:
java.lang.Exception - MoM specific

publish

public java.lang.String publish(java.lang.String changeKey,
                                byte[] message,
                                java.util.Map attrMap)
                         throws java.lang.Exception
Description copied from interface: I_ChangePublisher
Send the message to the MoM.

Specified by:
publish in interface I_ChangePublisher
Parameters:
changeKey - Can be used to create the topic name
message - The message content to send
attrMap - An optional map with attributes or null
Returns:
A unique identifier of the sent message
Throws:
java.lang.Exception - On sending problems

registerAlertListener

public boolean registerAlertListener(I_Update update,
                                     java.util.Map attrs)
                              throws java.lang.Exception
Description copied from interface: I_ChangePublisher
Register for alerts when the data source has changed.

This funtionality is plugin depending, for example the xmlBlaster plugin has a configuration option to subscribe on a alert topic and listens if somebody publishes a message to it. If such a message arrives we trigger a new database poll.

Specified by:
registerAlertListener in interface I_ChangePublisher
Parameters:
update - The callback interface to receive the notification
attrs - extra parameters to pass for the registration. For example if one implementation wants to do a specific extra subscription it would pass the quality of service in the attributes.
Returns:
true if a notification is available (is configured)
Throws:
java.lang.Exception - The MoM specific exception

shutdown

public void shutdown()
Description copied from interface: I_ChangePublisher
Cleanup resources.

Can be called multiple times if instance is reused from different plugins.

Specified by:
shutdown in interface I_ChangePublisher
Specified by:
shutdown in interface I_ContribPlugin
See Also:
I_Plugin

getUsedPropertyKeys

public java.util.Set getUsedPropertyKeys()
Description copied from interface: I_ContribPlugin
Gets all property keys which may be used by this object.

Specified by:
getUsedPropertyKeys in interface I_ContribPlugin
Returns:

timeout

public void timeout(java.lang.Object userData)
Description copied from interface: org.xmlBlaster.util.I_Timeout
You will be notified about the timeout through this method.

Specified by:
timeout in interface org.xmlBlaster.util.I_Timeout
Parameters:
userData - You get bounced back your userData which you passed with Timeout.addTimeoutListener()

main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.