com.ibm.db2.tools.repl.publication
Interface PublicationMsgProvider


public interface PublicationMsgProvider

A PublicationMsgProvider is the interface that defines how messages are created and produced. The caller creates an instance of a PublicationMsgProvider by using the PublicationMsgProviderFactory class. Once you have an instance, then add a listener to the provider and call dispatchMsgs. Note that dispatchMsgs is a synchronous call, so you might want to create a new thread to call dispatchMsgs.


Method Summary
 void addPublicationMsgListener(PublicationMsgListener listener)
          Add a listener to get the messages.
 void dispatchMsgs(javax.jms.MessageConsumer messageConsumer, int timeout, boolean ignoreErrors)
          This will start the messages to be dispatched to any listeners.
 void removePublicationMsgListener(PublicationMsgListener listener)
          Remove a listener.
 void stopMsgDispatching()
          This will stop the dispatching of messages, and cause the thread to return from dispatchMsgs().
 

Method Detail

dispatchMsgs

public void dispatchMsgs(javax.jms.MessageConsumer messageConsumer,
                         int timeout,
                         boolean ignoreErrors)
                  throws java.lang.Exception
This will start the messages to be dispatched to any listeners. The thread that calls this function will not return until some other thread calls stopMsgDispatching() or the timeout value is reached.

Parameters:
messageConsumer - Dispatch messages from this JMS message queue.
timeout - The time in milliseconds before the thread returns and stops dispatching msgs.
ignoreErrors - True: Ingore any errors when dispatching & formatting msgs. Any msg that contains an error will be thrown away. False: Throw exception on any msg errors.
java.lang.Exception

stopMsgDispatching

public void stopMsgDispatching()
This will stop the dispatching of messages, and cause the thread to return from dispatchMsgs().


addPublicationMsgListener

public void addPublicationMsgListener(PublicationMsgListener listener)
Add a listener to get the messages.

Parameters:
listener - The listener will be notified of all msgs.

removePublicationMsgListener

public void removePublicationMsgListener(PublicationMsgListener listener)
Remove a listener.

Parameters:
listener - The listener to remove.