com.ibm.di.connector
Class JMSConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.JMSConnector
All Implemented Interfaces:
ConnectorInterface, CheckpointRestartInterface, VersionInfoInterface, javax.jms.MessageListener
Direct Known Subclasses:
IBMMQConnector

public class JMSConnector
extends Connector
implements javax.jms.MessageListener, CheckpointRestartInterface, ConnectorInterface

The JMS Connector uses underlying implementations to access JMS based systems. Since the constructor is not defined in the JMS specification we actually need a java class for each JMS system.


Field Summary
static String JMS_BROKER
           
static String JMS_MESSAGE_PROPERTY
          The name under which the JMS Property is stored in the Entry
static String JMS_PASSWORD
           
static String JMS_Q_MANAGER
           
static String JMS_SERVER_CHANNEL
           
static String JMS_SSL_CIPHER
           
static String JMS_SSL_SERVER_CHANNEL
           
static String JMS_SSL_USE_FLAG
           
static String JMS_USERNAME
           
static String MESSAGE_ATTRIBUTE
          The attribute name used for plain text messages
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Fields inherited from interface com.ibm.di.server.CheckpointRestartInterface
RESTART_AFTER, RESTART_BEFORE, RESTART_IN
 
Constructor Summary
JMSConnector()
          Constructor for the JMSConnector object
 
Method Summary
 String acknowledge()
          Acknowledge all messages received in this topicSession.
 javax.jms.Message entry2message(Entry entry)
          Convert an entry to a JMS message.
 Entry findEntry(SearchCriteria search)
          Query the queue for specific messages.
 Entry getCheckpointInformation()
          Returns the state information for the connector.
 String getIBMCharset(javax.jms.BytesMessage bytesmessage)
           
 Entry getNextEntry()
          Gets the nextEntry attribute of the JMSConnector object
 javax.jms.Queue getQueue()
          Gets the sendQueue member of the JMSConnector object
 javax.jms.Queue getReadQueue()
          Gets the readQueue member of the JMSConnector object
 javax.jms.Queue getSendQueue()
          Gets the sendQueue member of the JMSConnector object
 javax.jms.Session getSession()
          Gets the Session member of the JMSConnector object If topicSession non equals to null then return topicSession else return queueSession
 javax.jms.Topic getTopic()
          Gets the topic member of the JMSConnector object
 String getVersion()
          Return version information
 void initialize(Object o)
          Initialize the Connector
 boolean isCheckpointRestartEnabled(int mode)
          Components that support checkpoint/restart for a specific mode must return TRUE from this method.
 Entry message2entry(javax.jms.Message m)
          Convert a JMS message to an entry.
 void onMessage(javax.jms.Message message)
          Handles the arrived message
 void prepareForRestart(ALState state, Entry restartInfo, int restartPoint)
          Notifies the connector of a restart situation.
 void putEntry(Entry entry)
          Send an entry to the JMS server.
 Entry queryReply(Entry entry)
          This method uses temporary queues/topics to implement the queryReply method.
 void reconnect()
          Reconnect to the underlying data source.
 void selectEntries()
          We only start the queue/topic listener thread if we are iterating
 void setFactory(javax.jms.ConnectionFactory factory)
          Sets topicFactory or queueFactory members of the JMSConnector object If param is instanceof TopicConnectionFactory set topicFactory If param is instanceof QueueConnectionFactory set queueFactory
 void setReadQueue(javax.jms.Queue queue)
          Sets the readQueue member of the JMSConnector object
 void setSendQueue(javax.jms.Queue queue)
          Sets the sendQueue member of the JMSConnector object
 void setTopic(javax.jms.Topic topic)
          Sets the topic member of the JMSConnector object
 void terminate()
          Close the connection
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logmsg, modEntry, modEntry, pushback, queryOperations, querySchema, queryTables, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminateServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.di.connector.ConnectorInterface
deleteEntry, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, queryOperations, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
 

Field Detail

MESSAGE_ATTRIBUTE

public static final String MESSAGE_ATTRIBUTE
The attribute name used for plain text messages

See Also:
Constant Field Values

JMS_MESSAGE_PROPERTY

public static final String JMS_MESSAGE_PROPERTY
The name under which the JMS Property is stored in the Entry

See Also:
Constant Field Values

JMS_BROKER

public static final String JMS_BROKER
See Also:
Constant Field Values

JMS_SERVER_CHANNEL

public static final String JMS_SERVER_CHANNEL
See Also:
Constant Field Values

JMS_SSL_SERVER_CHANNEL

public static final String JMS_SSL_SERVER_CHANNEL
See Also:
Constant Field Values

JMS_Q_MANAGER

public static final String JMS_Q_MANAGER
See Also:
Constant Field Values

JMS_SSL_USE_FLAG

public static final String JMS_SSL_USE_FLAG
See Also:
Constant Field Values

JMS_SSL_CIPHER

public static final String JMS_SSL_CIPHER
See Also:
Constant Field Values

JMS_USERNAME

public static final String JMS_USERNAME
See Also:
Constant Field Values

JMS_PASSWORD

public static final String JMS_PASSWORD
See Also:
Constant Field Values
Constructor Detail

JMSConnector

public JMSConnector()
Constructor for the JMSConnector object

Method Detail

getTopic

public javax.jms.Topic getTopic()
Gets the topic member of the JMSConnector object

Returns:
The topic value

setTopic

public void setTopic(javax.jms.Topic topic)
Sets the topic member of the JMSConnector object

Parameters:
topic - The topic value

getQueue

public javax.jms.Queue getQueue()
Gets the sendQueue member of the JMSConnector object

Returns:
The sendQueue value

getSendQueue

public javax.jms.Queue getSendQueue()
Gets the sendQueue member of the JMSConnector object

Returns:
The sendQueue value

getReadQueue

public javax.jms.Queue getReadQueue()
Gets the readQueue member of the JMSConnector object

Returns:
The readQueue value

setSendQueue

public void setSendQueue(javax.jms.Queue queue)
Sets the sendQueue member of the JMSConnector object

Parameters:
queue - The sendQueue value

setReadQueue

public void setReadQueue(javax.jms.Queue queue)
Sets the readQueue member of the JMSConnector object

Parameters:
queue - The readQueue value

getSession

public javax.jms.Session getSession()
Gets the Session member of the JMSConnector object If topicSession non equals to null then return topicSession else return queueSession

Returns:
The topicSession value

setFactory

public void setFactory(javax.jms.ConnectionFactory factory)
Sets topicFactory or queueFactory members of the JMSConnector object If param is instanceof TopicConnectionFactory set topicFactory If param is instanceof QueueConnectionFactory set queueFactory

Parameters:
factory - The TopicConnectionFactory or QueueConnectionFactory object

getNextEntry

public Entry getNextEntry()
                   throws Exception
Gets the nextEntry attribute of the JMSConnector object

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
The nextEntry value
Throws:
Exception - if the operation does not succeed
See Also:
Connector.selectEntries()

acknowledge

public String acknowledge()
Acknowledge all messages received in this topicSession.

Returns:
- null if OK, a string containing the error message if failure

terminate

public void terminate()
Close the connection

Specified by:
terminate in interface ConnectorInterface
Overrides:
terminate in class Connector

initialize

public void initialize(Object o)
                throws Exception
Initialize the Connector

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
o - The mode of the Connector
Throws:
Exception - if the initialization fails

selectEntries

public void selectEntries()
                   throws Exception
We only start the queue/topic listener thread if we are iterating

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - if an exception occurs while listening for messages

findEntry

public Entry findEntry(SearchCriteria search)
                throws Exception
Query the queue for specific messages. If jms.lookupConsumesMessage is true then we use the JMS QueueReceiver otherwise the QueueBrowser is used.

Specified by:
findEntry in interface ConnectorInterface
Overrides:
findEntry in class Connector
Parameters:
search - The search criteria for message selection
Returns:
Returns the first entry found or null if no entries were found
Throws:
Exception - Any JMS error

putEntry

public void putEntry(Entry entry)
              throws Exception
Send an entry to the JMS server.

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
entry - The entry to send
Throws:
Exception - If the sending of a message fails

queryReply

public Entry queryReply(Entry entry)
                 throws Exception
This method uses temporary queues/topics to implement the queryReply method. The receiver of the message must heed the replyTo property of the message.

Specified by:
queryReply in interface ConnectorInterface
Overrides:
queryReply in class Connector
Parameters:
entry - The data used in outgoing call
Returns:
The entry returned by the peer
Throws:
Exception - Any exceptions thrown by the connector's underlying classes

onMessage

public void onMessage(javax.jms.Message message)
Handles the arrived message

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
message - The received message

entry2message

public javax.jms.Message entry2message(Entry entry)
                                throws Exception
Convert an entry to a JMS message. Use the configuration to determine how the generated JMS message should be like.

Parameters:
entry - The entry to convert
Returns:
The JMS message
Throws:
Exception

getIBMCharset

public String getIBMCharset(javax.jms.BytesMessage bytesmessage)
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException

message2entry

public Entry message2entry(javax.jms.Message m)
                    throws Exception
Convert a JMS message to an entry.

Parameters:
m - The JMS message to convert
Returns:
An entry object
Throws:
Exception

isCheckpointRestartEnabled

public boolean isCheckpointRestartEnabled(int mode)
Components that support checkpoint/restart for a specific mode must return TRUE from this method. If a restart has no meaning for mode then the connector should still return TRUE.

Specified by:
isCheckpointRestartEnabled in interface CheckpointRestartInterface
Parameters:
mode - The mode the connector runs in
Returns:
true if checkpoint is supported in mode
See Also:
ServerConstants

getCheckpointInformation

public Entry getCheckpointInformation()
                               throws Exception
Returns the state information for the connector. If for some reason the connector decidies that a restart is impossible it must throw an exception. The method is called immediatly before any component methods are called. If there is no need to save any state information a null value should be returned. For eventhandlers this method is called by the dispatcher routine.

Specified by:
getCheckpointInformation in interface CheckpointRestartInterface
Returns:
The entry the connector needs to do a restart or null if that is not needed.
Throws:
Exception

prepareForRestart

public void prepareForRestart(ALState state,
                              Entry restartInfo,
                              int restartPoint)
                       throws Exception
Notifies the connector of a restart situation. This method is called after the connector has been loaded and before any other method calls are made to the connector. If the connector decides it cannot restart it must throw an exception.

Specified by:
prepareForRestart in interface CheckpointRestartInterface
Parameters:
restartInfo - The last entry object returned by the connector in the getCheckpointInformation method
state - The ALState object for the AssemblyLine
restartPoint - The relative point where restarting is taking place (e.g. RESTART_BEFORE ...)
Throws:
Exception

getVersion

public String getVersion()
Return version information

Specified by:
getVersion in interface VersionInfoInterface
Returns:
The version value

reconnect

public void reconnect()
               throws Exception
Description copied from class: Connector
Reconnect to the underlying data source.

Overrides:
reconnect in class Connector
Throws:
Exception