com.ibm.dse.services.mq
Class MQConnection

java.lang.Object
  |
  +--com.ibm.dse.base.DSENotifier
        |
        +--com.ibm.dse.base.Service
              |
              +--com.ibm.dse.services.mq.MQConnection

public class MQConnection
extends Service
implements java.lang.Runnable, MQConnectionService

This class maps a MQ connection to a MQManager with the defined queues.

See Also:
Serialized Form

Field Summary
protected  QueueListener aQueueListener
           
 java.lang.String channelQName
          The Channel Reply Queue name.
static java.lang.String COMPID
           
static java.lang.String DATA
           
static java.lang.String DEADLETTERQ
          DeadLetter Queue representation field.
 java.lang.String deadLetterQName
          The DeadLetter Queue name.
 MqDeadLetterQueueThread deadLetterQueueThread
          MqDeadLetterQueueThread field.
static java.lang.reflect.Field encode
           
protected  boolean isDeadLetterThreadAlive
           
static java.lang.String LISTEN_THREAD
          Listen Thread representation field.
 java.lang.String QMgrName
          The QueueManager name.
static java.lang.String QMGRNAME
           
static java.lang.String QUEUE
           
 Semaphore receiveSem
          The receiver semaphore.
static java.lang.String REPLYTOQ
           
 java.lang.String ReplyToQName
          The Reply Queue name.
static java.lang.String RESET
           
static java.lang.String SENDTOQ
           
 java.lang.String SendToQName
          The Send Queue name.
 
Fields inherited from class com.ibm.dse.base.Service
externalizer
 
Fields inherited from class com.ibm.dse.base.DSENotifier
handlersList, name
 
Fields inherited from interface com.ibm.dse.services.mq.MQConnectionService
CODEPAGE, DSEUSER, MQ_CHANNEL_NAME_LENGTH, MQCACH_CHANNEL_NAME, MQCC_OK, MQCCSI_DEFAULT, MQCFC_LAST, MQCFH_STRUC_LENGTH, MQCFH_VERSION_1, MQCFIN_STRUC_LENGTH, MQCFST_STRUC_LENGTH_FIXED, MQCFT_COMMAND, MQCFT_INTEGER, MQCFT_STRING, MQCHS_BINDING, MQCHS_INACTIVE, MQCHS_INITIALIZING, MQCHS_PAUSED, MQCHS_REQUESTING, MQCHS_RETRYING, MQCHS_RUNNING, MQCHS_STARTING, MQCHS_STOPPED, MQCHS_STOPPING, MQCMD_INQUIRE_CHANNEL_STATUS, MQCMD_RESET_CHANNEL, MQCMD_START_CHANNEL, MQCMD_STOP_CHANNEL, MQIACH_CHANNEL_STATUS, MQIACH_MSG_SEQUENCE_NUMBER, MQRC_NONE, MQRCCF_CHANNEL_IN_USE, NORC
 
Fields inherited from interface com.ibm.dse.services.comms.CommonCommunicationsService
CLOSED, DATA, DATASENT, ERROR, OPENED, RECEIVERC, TIMEOUT
 
Constructor Summary
MQConnection()
          This class is used to maintains a connection to a MQManager with the defined queues.
MQConnection(java.lang.String aName)
          This class is used to maintains a connection to a MQManager with the defined queues.
 
Method Summary
 void addQueueListener(QueueListener newListener)
          Adds a listener to Queue
 void ccClose()
          Closes the communications chanel.
 void ccOpen()
          Opens the communications channel.
 CCMessage ccReceiveData(long aTimeout)
          Reads the data that has been received.If the data is not ready, it waits for the timeout.
 void ccSendData(java.lang.String aString)
          Sends a Data through the communications channel.
 CCMessage ccSendReceive(java.lang.String aString, long aTimeout)
          Sends a String to communication services, and waits for a Timeout to receive the data.
 void closeConnection()
          Disconnects from queue manager, and removes the used queues.
 void disconnectQueueManager()
          Disconnects the queueManagers related to send, receive,channel and DeadLetter operations.
 void establishConnection()
          Establishes a connection with a MQManager, and opens the send and receive queues.
 void fireMessageReceived(QueueEvent event)
          Supports listener events.
 java.lang.String getApplicationName()
          Gets the applicationName property (java.lang.String) value.
 boolean getAutomaticConnectionEstablishment()
          Gets the automaticSessionEstablishment property (java.lang.Boolean) value.
 java.lang.String getCcClosedEventName()
           Returns the name of the closed event.
 java.lang.String getCcDataReceivedEventName()
           Returns the name of the errorReceived event.
 java.lang.String getCcErrorReceivedEventName()
           Returns the name of the errorReceived event.
 java.lang.String getCcOpenedEventName()
           Returns the name of the opened event.
 java.lang.String getchannelName()
          Gets the channel property (java.lang.String) value.
 int getChannelStatus(java.lang.String channelName)
          Returns the channel status from the inquired channel.
 int getCharSet()
          Gets the charSet property value.
 java.lang.String getDeadLetterQName()
          Gets the deadLetterQName property (java.lang.String) value.
 int getEncoding()
          Gets the encoding property value.
 int getEstablishConnectionRetries()
          Gets the establishConnectionRetries property (int) value.
 java.lang.String getFormat()
          Gets the format property value.
 com.ibm.mq.MQMessage getFromDeadLetterQueue()
          Gets a message from the DeadLetterQueue.
 com.ibm.mq.MQMessage getFromGetReplyQueue()
          Gets a message from the replyqueue.
 com.ibm.mq.MQMessage getFromGetReplyQueue(byte[] aCorrelationId)
          Gets a message with a correlation identifier(aCorrelationId) from the replyqueue .
 int getGetMessageOptionsOptions()
           Gets the get message options (int) value.
 java.lang.String getHostName()
          Gets the hostName property (java.lang.String) value.
 boolean getInUse()
          Gets the inUse property (boolean) value.
 boolean getMatchCorrelationId()
          Gets the matchCorrelationId property (boolean) value.
 int getMessageType()
          Gets the messageType property value.
 int getPersistence()
          Gets the persistence property value.
 int getPortNumber()
           Gets the port number(int) value.
 int getPutMessageOptionsOptions()
           Gets the put message options (int) value.
 java.lang.String getQmgrReply()
          Gets the QmgrReply property value.
 java.lang.String getQueueManagerName()
           Gets the queue manager name (String) value.
 java.lang.String getReplyToQName()
          Gets the replyToQName property (java.lang.String) value.
 int getReplyToQOpenOptions()
           Gets the ReplyToQ open options (int) value.
 java.lang.String getSendToQName()
          Gets the sendToQName property (java.lang.String) value.
 int getSendToQOpenOptions()
           Gets the SendToQ open options (int) value.
 boolean getServer()
          Gets the server property (java.lang.Boolean) value.
 java.lang.String getStatus()
          Gets the connection status value.
 boolean getSynchronousMode()
          Gets the synchronousMode property (boolean) value.
 int getTimeBetweenRetries()
          Gets the timeBetweenRetries property (int) value.
 int getTimeout()
          Gets the timeout property value.
 java.lang.String getUserId()
          Gets the userId property value.
protected  void initializeCounter()
          Sets the EstablishConnectionSessionCounter property to its default value.
 java.lang.Object initializeFrom(Tag aTag)
           Actualizes all attributes that are defined in SGML files.
 void initInstance()
          Initiates all handlers that have a default treatment.
 void initManagers()
          Initiates all handlers that have a default treatment.
 boolean isCloseMessage(java.lang.Object aMessage)
          Checks if close Message has been received.
 boolean isDeadLetterQReset()
          Checks if DeadLetter queue manager is open.
 boolean isFree()
          Returns if the session is free
 boolean isOffline()
          Returns if the session is offline
 boolean isResetStatus()
          Checks if queue managers are open.
 byte[] putToPutSendQueue(com.ibm.mq.MQMessage aMessage)
          Puts aMessage(MQMessage) in the putSendQueue and returns the correlation identifier for this message.
 byte[] putToPutSendQueue(java.lang.String aData)
          Puts a MQMessage in the putSendQueue, creates data aData and message default options,and returns the correlation ID of this message,
 java.lang.Object receive(byte[] aCorrelationId)
          Performs the receive method.
 java.lang.Object receive(byte[] aCorrelationId, long aTimeout)
          Performs the receive method.
 void receiveFromDeadLetterQueue()
           Performs the receive method, which is used by listen threads when it is working in asynchronous mode
 void removeQueueListener(QueueListener newListener)
          Removes queue listener.
 int resetChannel(java.lang.String channelName)
          Resets the message sequence number for a channel.
 int resetChannel(java.lang.String channelName, int msgSeqNumber)
          Resets the message sequence number for a channel.
 DSECCException returnException(java.lang.Exception e)
           Maps the MQException to the DSECCException
 java.lang.String returnStringFromMessage(java.lang.Object aMessage)
          Obtains the msgText(String) from a MQMessage.
 void run()
          Run method.
 byte[] send(Context aContext, FormatElement aFormat)
           Performs the send method.
 byte[] send(Context aContext, java.lang.String aFormatName)
           Performs the send method.
 byte[] send(java.lang.Object inputMessage)
          Performs the send method.
 byte[] send(java.lang.String inputMessage)
           Performs the send method.
 void setApplicationName(java.lang.String newApplicationName)
          Sets the applicationName property (java.lang.String) value.
 void setAutomaticConnectionEstablishment(boolean automaticEstablishment)
          Sets the automaticConnectionEstablishment property (boolean) value.
 void setChannelName(java.lang.String chname)
          Sets the Channel property (java.lang.String) value.
 void setCharSet(int newCharSet)
          Sets the charSet property value.
 void setDeadLetterMessageOptionsMatchOptions(int options)
          Sets DeadLetterQueue match Options property (MQGetMessageOptions) value.
 void setDeadLetterMessageOptionsWaitInterval(int options)
          Sets DeadLetterQueue option waitInterval property (MQGetMessageOptions) value.
 void setDeadLetterQName(java.lang.String dlname)
          Sets the deadLetterQName property (java.lang.String) value.
 void setEncoding(int newEncoding)
          Sets the encoding property value.
 void setEstablishConnectionRetries(int establishConnectionRetries)
          Sets the establishSessionRetries property (int) value.
 void setFormat(java.lang.String newFormat)
          Sets the format property (java.lang.String) value.
 void setGetMessageOptionsMatchOptions(int options)
          Sets GetMessageOptions match Options property (MQGetMessageOptions) value.
 void setGetMessageOptionsOptions(int options)
          Sets GetMessageOptions Options field property (int) value.
 void setGetMessageOptionsWaitInterval(int options)
          Sets GetMessageOptions WaitInterval field property (MQGetMessageOptions) value.
 void setHostName(java.lang.String hname)
          Sets the Host name property (java.lang.String) value.
 void setInUse(boolean anInUse)
          Sets the inUse property (boolean) value.
 void setMatchCorrelation(boolean newValue)
          Sets the matchCorrelation property (boolean) value.
 void setMessageType(int newMessageType)
          Sets the messageType property value.
 void setPersistence(int newPersistence)
          Sets the persistence property value.
 void setPortNumber(int pnum)
          Sets the Port number property (int) value.
 void setPutMessageOptionsOptions(int options)
          Sets PutMessageOptions Options field property (int) value.
 void setQmgrName(java.lang.String qmgrname)
          Sets the QMgrName property (java.lang.String) value.
 void setQmgrReply(java.lang.String newQmgrReply)
          Sets the QmgrReply property (java.lang.String) value.
 void setReplyQName(java.lang.String rqname)
          Sets the ReplyToQName property (java.lang.String) value.
 void setReplyToQOpenOptions(int options)
          Sets ReplyToQOpenOptions field property (int) value.
 void setSendQName(java.lang.String sqname)
          Sets the SendToQName property (java.lang.String) value.
 void setSendToQOpenOptions(int options)
          Sets SendToQOpenOptions field property (int) value.
 void setServer(boolean aBoolean)
          Sets the server property (boolean) value.
 void setSynchronousMode(boolean aSynchronousMode)
          Sets the synchronousMode property (boolean) value.
 void setTimeBetweenRetries(int timeBetweenRetries)
          Sets the timeBetweenRetries property (int) value.
 void setTimeout(int newTimeout)
          Sets the timeout property value.
 void setUserId(java.lang.String newUserId)
          Sets the userId property (java.lang.String) value.
 int startChannel(java.lang.String channelName)
          Starts the specified channel.
 int stopChannel(java.lang.String channelName)
          Stops the specified channel.
 void terminate()
          Terminates the conversation.
 java.lang.String toString()
          Returns a visual representation of this object.
 
Methods inherited from class com.ibm.dse.base.Service
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toStrings, toTags, writeExternal, writeExternal
 
Methods inherited from class com.ibm.dse.base.DSENotifier
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

receiveSem

public Semaphore receiveSem
The receiver semaphore.

LISTEN_THREAD

public static final java.lang.String LISTEN_THREAD
Listen Thread representation field.

DEADLETTERQ

public static final java.lang.String DEADLETTERQ
DeadLetter Queue representation field.

aQueueListener

protected transient QueueListener aQueueListener

QMgrName

public java.lang.String QMgrName
The QueueManager name. The value is externalized in the SGML files

SendToQName

public java.lang.String SendToQName
The Send Queue name. The value is externalized in the SGML files

ReplyToQName

public java.lang.String ReplyToQName
The Reply Queue name. The value is externalized in the SGML files

channelQName

public java.lang.String channelQName
The Channel Reply Queue name. The value must be externalized in the SGML files

deadLetterQName

public java.lang.String deadLetterQName
The DeadLetter Queue name.

deadLetterQueueThread

public MqDeadLetterQueueThread deadLetterQueueThread
MqDeadLetterQueueThread field.

RESET

public static final java.lang.String RESET

DATA

public static final java.lang.String DATA

QUEUE

public static final java.lang.String QUEUE

QMGRNAME

public static final java.lang.String QMGRNAME

SENDTOQ

public static final java.lang.String SENDTOQ

REPLYTOQ

public static final java.lang.String REPLYTOQ

encode

public static java.lang.reflect.Field encode

COMPID

public static final java.lang.String COMPID

isDeadLetterThreadAlive

protected boolean isDeadLetterThreadAlive
Constructor Detail

MQConnection

public MQConnection()
This class is used to maintains a connection to a MQManager with the defined queues.

MQConnection

public MQConnection(java.lang.String aName)
             throws java.io.IOException
This class is used to maintains a connection to a MQManager with the defined queues.
Parameters:
aName - java.lang.String
Throws:
java.io.IOException - .
Method Detail

addQueueListener

public void addQueueListener(QueueListener newListener)
Adds a listener to Queue
Specified by:
addQueueListener in interface MQConnectionService
Parameters:
newListener - com.ibm.dse.services.mq.QueueListener

ccClose

public void ccClose()
             throws DSECCException

Closes the communications chanel. It returns control immediately.If the communications channel is started correctly, the event ChannelClosed is signaled.

Parameters:
aString - java.lang.String
Throws:
DSECCException - .

ccOpen

public void ccOpen()
            throws DSECCException

Opens the communications channel. It returns control immediately.If the communications channel is started correctly, the event ChannelOpened is signaled.

Throws:
DSECCException - .

ccReceiveData

public CCMessage ccReceiveData(long aTimeout)
                        throws DSECCException

Reads the data that has been received.If the data is not ready, it waits for the timeout.

Parameters:
aTimeout - long
Throws:
DSECCException. -  

ccSendData

public void ccSendData(java.lang.String aString)
                throws DSECCException

Sends a Data through the communications channel. It returns control immediately. When a response is received, two events might be signaled: DataReceived event (in case of data received) or ErrorReceived(in case of error).

Parameters:
aString - java.lang.String
Throws:
DSECCException. -  

ccSendReceive

public CCMessage ccSendReceive(java.lang.String aString,
                               long aTimeout)
                        throws DSECCException

Sends a String to communication services, and waits for a Timeout to receive the data.

Parameters:
aString - java.lang.String
aTimeout - long
Throws:
DSECCException. -  

closeConnection

public void closeConnection()
                     throws com.ibm.mq.MQException

Disconnects from queue manager, and removes the used queues.

Specified by:
closeConnection in interface MQConnectionService
Throws:
com.ibm.mq.MQException. -  

disconnectQueueManager

public void disconnectQueueManager()
                            throws com.ibm.mq.MQException

Disconnects the queueManagers related to send, receive,channel and DeadLetter operations.


establishConnection

public void establishConnection()
                         throws com.ibm.mq.MQException

Establishes a connection with a MQManager, and opens the send and receive queues.

Specified by:
establishConnection in interface MQConnectionService
Throws:
com.ibm.mq.MQException. -  

fireMessageReceived

public void fireMessageReceived(QueueEvent event)

Supports listener events.

Specified by:
fireMessageReceived in interface MQConnectionService
Parameters:
event - com.ibm.dse.services.mq.QueueEvent

getApplicationName

public java.lang.String getApplicationName()

Gets the applicationName property (java.lang.String) value.

Returns:
java.lang.String
See Also:
setApplicationName(java.lang.String)

getAutomaticConnectionEstablishment

public boolean getAutomaticConnectionEstablishment()

Gets the automaticSessionEstablishment property (java.lang.Boolean) value.

Specified by:
getAutomaticConnectionEstablishment in interface MQConnectionService
Returns:
The automaticSessionEstablishment property value.
See Also:
#setAutomaticSessionEstablishment

getCcClosedEventName

public java.lang.String getCcClosedEventName()

Returns the name of the closed event.


getCcDataReceivedEventName

public java.lang.String getCcDataReceivedEventName()

Returns the name of the errorReceived event.


getCcErrorReceivedEventName

public java.lang.String getCcErrorReceivedEventName()

Returns the name of the errorReceived event.


getCcOpenedEventName

public java.lang.String getCcOpenedEventName()

Returns the name of the opened event.


getchannelName

public java.lang.String getchannelName()
Gets the channel property (java.lang.String) value.
Returns:
The channel property value.

getChannelStatus

public int getChannelStatus(java.lang.String channelName)
                     throws com.ibm.mq.MQException

Returns the channel status from the inquired channel.

Parameters:
channelName - The name of the inquired channel.
Throws:
com.ibm.mq.MQException. -  

getCharSet

public int getCharSet()

Gets the charSet property value.

Returns:
int
See Also:
setCharSet(int)

getDeadLetterQName

public java.lang.String getDeadLetterQName()
Gets the deadLetterQName property (java.lang.String) value.
Specified by:
getDeadLetterQName in interface MQConnectionService
Returns:
The deadLetterQName property value.

getEncoding

public int getEncoding()

Gets the encoding property value.

Returns:
int
See Also:
setEncoding(int)

getEstablishConnectionRetries

public int getEstablishConnectionRetries()

Gets the establishConnectionRetries property (int) value. If it is negative, it means that the session retries to establish forever, otherwise this property says how many times it will establish itself.

Returns:
The establishConnectionRetries property value.
See Also:
setEstablishConnectionRetries(int)

getFormat

public java.lang.String getFormat()

Gets the format property value.

Returns:
java.lang.String
See Also:
setFormat(java.lang.String)

getFromDeadLetterQueue

public com.ibm.mq.MQMessage getFromDeadLetterQueue()
                                            throws com.ibm.mq.MQException

Gets a message from the DeadLetterQueue.

Returns:
the MQMessage read.
Throws:
MQException. -  

getFromGetReplyQueue

public com.ibm.mq.MQMessage getFromGetReplyQueue()
                                          throws com.ibm.mq.MQException,
                                                 java.io.IOException

Gets a message from the replyqueue.

Returns:
the MQMessage read.
Throws:
MQException. -  

getFromGetReplyQueue

public com.ibm.mq.MQMessage getFromGetReplyQueue(byte[] aCorrelationId)
                                          throws com.ibm.mq.MQException,
                                                 java.io.IOException

Gets a message with a correlation identifier(aCorrelationId) from the replyqueue .

Returns:
The MQMessage read.
Throws:
MQException. -  

getGetMessageOptionsOptions

public int getGetMessageOptionsOptions()

Gets the get message options (int) value.

Returns:
The GetMessageOptions value.

getHostName

public java.lang.String getHostName()
Gets the hostName property (java.lang.String) value.
Returns:
The hostName property value.

getInUse

public boolean getInUse()

Gets the inUse property (boolean) value. If true, if this instance is in use.

Returns:
The inUse property value.
See Also:
setInUse(boolean)

getMatchCorrelationId

public boolean getMatchCorrelationId()

Gets the matchCorrelationId property (boolean) value. If true,on the receive method, the service matches the message correlation identifier.If false message identifier is used as selection match criteria.

Returns:
The matchCorrelationId property value.
See Also:
#setmatchCorrelationId

getMessageType

public int getMessageType()

Gets the messageType property value.

Returns:
int
See Also:
setMessageType(int)

getPersistence

public int getPersistence()

Gets the persistence property value.

Returns:
int
See Also:
setPersistence(int)

getPortNumber

public int getPortNumber()

Gets the port number(int) value.

Returns:
The port value.

getPutMessageOptionsOptions

public int getPutMessageOptionsOptions()

Gets the put message options (int) value.

Returns:
The putMessageOptions value.

getQmgrReply

public java.lang.String getQmgrReply()

Gets the QmgrReply property value.

Returns:
java.lang.String
See Also:
setQmgrReply(java.lang.String)

getQueueManagerName

public java.lang.String getQueueManagerName()

Gets the queue manager name (String) value.

Returns:
The Queue manager name value.

getReplyToQName

public java.lang.String getReplyToQName()
Gets the replyToQName property (java.lang.String) value.
Returns:
The replyToQName property value.

getReplyToQOpenOptions

public int getReplyToQOpenOptions()

Gets the ReplyToQ open options (int) value.

Returns:
The ReplyToQOpenOptions value.

getSendToQName

public java.lang.String getSendToQName()
Gets the sendToQName property (java.lang.String) value.
Returns:
The sendToQName property value.

getSendToQOpenOptions

public int getSendToQOpenOptions()

Gets the SendToQ open options (int) value.

Returns:
The SendToQOpenOptions value.

getServer

public boolean getServer()

Gets the server property (java.lang.Boolean) value.

Returns:
The automaticSessionEstablishment property value.

getStatus

public java.lang.String getStatus()

Gets the connection status value. Possible values are:

Specified by:
getStatus in interface MQConnectionService
Returns:
The sessionStatus property value.
See Also:
#setSessionStatus

getSynchronousMode

public boolean getSynchronousMode()

Gets the synchronousMode property (boolean) value. If the synchronousMode is true, no event or Java events are signaled.

Returns:
The confirmMode property value.
See Also:
#setConfirmMode

getTimeBetweenRetries

public int getTimeBetweenRetries()
Gets the timeBetweenRetries property (int) value. It is the time (specified in seconds in services SGML file but stored in milisecons) between each unsuccessful attempt to establish session.
Returns:
The timeBetweenRetries property value.
See Also:
setTimeBetweenRetries(int)

getTimeout

public int getTimeout()

Gets the timeout property value.

Returns:
int
See Also:
setTimeout(int)

getUserId

public java.lang.String getUserId()

Gets the userId property value.

Returns:
java.lang.String
See Also:
setUserId(java.lang.String)

initializeCounter

protected void initializeCounter()
Sets the EstablishConnectionSessionCounter property to its default value.

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException,
                                       DSEException

Actualizes all attributes that are defined in SGML files. If automaticConversationEstablishment is true the establishConversation is issued.

Overrides:
initializeFrom in class Service
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException. -  
DSEException - .

initInstance

public void initInstance()
                  throws DSECCException,
                         DSEInvalidArgumentException

Initiates all handlers that have a default treatment. It also creates the listenThread.

Throws:
com.ibm.dse.base.DSEInvalidArgumentException. -  
DSEException - .

initManagers

public void initManagers()
                  throws com.ibm.mq.MQException

Initiates all handlers that have a default treatment. It also creates the listenThread.

Throws:
com.ibm.dse.base.DSEInvalidArgumentException. -  
DSEException - .

isCloseMessage

public boolean isCloseMessage(java.lang.Object aMessage)

Checks if close Message has been received.

Returns:
if close Message has been received.

isDeadLetterQReset

public boolean isDeadLetterQReset()

Checks if DeadLetter queue manager is open.

Returns:
if status is Reset.

isFree

public boolean isFree()

Returns if the session is free

Returns:
boolean

isOffline

public boolean isOffline()

Returns if the session is offline

Returns:
boolean

isResetStatus

public boolean isResetStatus()

Checks if queue managers are open.

Returns:
if status is Reset.

putToPutSendQueue

public byte[] putToPutSendQueue(com.ibm.mq.MQMessage aMessage)
                         throws com.ibm.mq.MQException

Puts aMessage(MQMessage) in the putSendQueue and returns the correlation identifier for this message.

Parameters:
aMessage - The message to put into the send queue.
Returns:
correlationId for the Message inserted into the send queue.
Throws:
MQException. -  

putToPutSendQueue

public byte[] putToPutSendQueue(java.lang.String aData)
                         throws com.ibm.mq.MQException,
                                java.io.IOException

Puts a MQMessage in the putSendQueue, creates data aData and message default options,and returns the correlation ID of this message,

Parameters:
aMessage - The message to put into the send queue.
Returns:
correlationId for the Message inserted into the send queue.
Throws:
MQException. -  
java.io.IOException. -  

receive

public java.lang.Object receive(byte[] aCorrelationId)
                         throws com.ibm.mq.MQException,
                                java.io.IOException
Performs the receive method.
Specified by:
receive in interface MQConnectionService
Returns:
java.lang.String
Throws:
com.ibm.mq.MQException. -  

receive

public java.lang.Object receive(byte[] aCorrelationId,
                                long aTimeout)
                         throws com.ibm.mq.MQException,
                                java.io.IOException
Performs the receive method.
Specified by:
receive in interface MQConnectionService
Parameters:
correlationId(byte[]). - The message correlation identifier to get the correct message.
timeout(long). -  
Returns:
java.lang.String
Throws:
com.ibm.mq.MQException. -  

receiveFromDeadLetterQueue

public void receiveFromDeadLetterQueue()

Performs the receive method, which is used by listen threads when it is working in asynchronous mode


removeQueueListener

public void removeQueueListener(QueueListener newListener)
Removes queue listener.
Specified by:
removeQueueListener in interface MQConnectionService
Parameters:
newListener - com.ibm.dse.services.mq.QueueListener

resetChannel

public int resetChannel(java.lang.String channelName)
                 throws com.ibm.mq.MQException

Resets the message sequence number for a channel.

Parameters:
channelName - The name of the channel to be reset.
Returns:
Returns code related to operation. Possible values are:
  • 0 : Success
  • 2 : Fail
  • -1 : Operation not available
Throws:
com.ibm.mq.MQException. -  

resetChannel

public int resetChannel(java.lang.String channelName,
                        int msgSeqNumber)
                 throws com.ibm.mq.MQException

Resets the message sequence number for a channel.

Parameters:
channelName - The name of the channel to be reset.
msgSeqNumber. - Spcifies the new sequence number.
Returns:
Returns code related to operation. Possible values are:
  • 0 : Success
  • 2 : Fail
  • -1 : Operation not available
Throws:
com.ibm.mq.MQException. -  

returnException

public DSECCException returnException(java.lang.Exception e)

Maps the MQException to the DSECCException

Returns:
DSECCException.

returnStringFromMessage

public java.lang.String returnStringFromMessage(java.lang.Object aMessage)
                                         throws DSECCException
Obtains the msgText(String) from a MQMessage.
Returns:
String msgText.
Throws:
DSECCException. -  

run

public void run()
Run method.
Specified by:
run in interface java.lang.Runnable

send

public byte[] send(Context aContext,
                   FormatElement aFormat)
            throws DSEException,
                   com.ibm.mq.MQException,
                   java.io.IOException

Performs the send method.

Parameters:
aContext - com.ibm.dse.base.Context. The context element object.
aFormat - com.ibm.dse.base.FormatElement.The format element object.
Returns:
byte[] correlationId.
Throws:
com.ibm.dse.base.DSEException. -  
com.ibm.mq.MQException. -  
java.io.IOException. -  

send

public byte[] send(Context aContext,
                   java.lang.String aFormatName)
            throws DSEException,
                   com.ibm.mq.MQException

Performs the send method.

Parameters:
aContext - com.ibm.dse.base.Context.The format elem
aFormatName - java.lang.String.The format element name.
Returns:
byte[] correlationId.
Throws:
com.ibm.mq.MQException. -  
com.ibm.dse.base.DSEException. -  

send

public byte[] send(java.lang.Object inputMessage)
            throws com.ibm.mq.MQException
Performs the send method.
Specified by:
send in interface MQConnectionService
Parameters:
aString - java.lang.String
Returns:
byte[] correlationId.
Throws:
com.ibm.mq.MQException. -  

send

public byte[] send(java.lang.String inputMessage)
            throws com.ibm.mq.MQException,
                   java.io.IOException

Performs the send method.

Specified by:
send in interface MQConnectionService
Parameters:
aString - java.lang.String
Returns:
byte[] correlationId.
Throws:
com.ibm.mq.MQException. -  
java.io.IOException. -  

setApplicationName

public void setApplicationName(java.lang.String newApplicationName)
Sets the applicationName property (java.lang.String) value.
Parameters:
newApplicationName - java.lang.String
See Also:
getApplicationName()

setAutomaticConnectionEstablishment

public void setAutomaticConnectionEstablishment(boolean automaticEstablishment)

Sets the automaticConnectionEstablishment property (boolean) value.

Parameters:
automaticEstablishment - The new value for the property.
See Also:
getAutomaticConnectionEstablishment()

setChannelName

public void setChannelName(java.lang.String chname)
Sets the Channel property (java.lang.String) value.
Parameters:
The - Channel(java.lang.String) property value.

setCharSet

public void setCharSet(int newCharSet)

Sets the charSet property value.

Parameters:
newCharSet - int
See Also:
getCharSet()

setDeadLetterMessageOptionsMatchOptions

public void setDeadLetterMessageOptionsMatchOptions(int options)

Sets DeadLetterQueue match Options property (MQGetMessageOptions) value.

Parameters:
options(int). - The DeadLetter message matchOptions.

setDeadLetterMessageOptionsWaitInterval

public void setDeadLetterMessageOptionsWaitInterval(int options)

Sets DeadLetterQueue option waitInterval property (MQGetMessageOptions) value.

Parameters:
options(int). - The waitInterval DeadLetter message option.

setDeadLetterQName

public void setDeadLetterQName(java.lang.String dlname)
Sets the deadLetterQName property (java.lang.String) value.
Parameters:
The - deadLetterQName(java.lang.String) property value.

setEncoding

public void setEncoding(int newEncoding)

Sets the encoding property value.

Parameters:
newEncoding - int
See Also:
getEncoding()

setEstablishConnectionRetries

public void setEstablishConnectionRetries(int establishConnectionRetries)
Sets the establishSessionRetries property (int) value.
Parameters:
establishSessionRetries - The new value for the property.
See Also:
#getEstablishSessionRetries

setFormat

public void setFormat(java.lang.String newFormat)
Sets the format property (java.lang.String) value.
Parameters:
newFormat - java.lang.String

setGetMessageOptionsMatchOptions

public void setGetMessageOptionsMatchOptions(int options)

Sets GetMessageOptions match Options property (MQGetMessageOptions) value.

Parameters:
options(int). - The GetMessageOptions matchoptions.

setGetMessageOptionsOptions

public void setGetMessageOptionsOptions(int options)

Sets GetMessageOptions Options field property (int) value.

Parameters:
options(int). - The GetMessageOptions options.

setGetMessageOptionsWaitInterval

public void setGetMessageOptionsWaitInterval(int options)

Sets GetMessageOptions WaitInterval field property (MQGetMessageOptions) value.

Parameters:
options(int). - The WaitInterval GetMessageOptions option.

setHostName

public void setHostName(java.lang.String hname)
Sets the Host name property (java.lang.String) value.
Parameters:
The - hostName(java.lang.String) property value.

setInUse

public void setInUse(boolean anInUse)

Sets the inUse property (boolean) value.

Parameters:
anInUse - The new value for the property.
See Also:
getInUse()

setMatchCorrelation

public void setMatchCorrelation(boolean newValue)

Sets the matchCorrelation property (boolean) value.

Parameters:
newValue - The new value for the property.
See Also:
#getmatchCorrelation

setMessageType

public void setMessageType(int newMessageType)

Sets the messageType property value.

Parameters:
newMessageType - int

setPersistence

public void setPersistence(int newPersistence)

Sets the persistence property value.

Parameters:
newPersistence - int
See Also:
getPersistence()

setPortNumber

public void setPortNumber(int pnum)
Sets the Port number property (int) value.
Parameters:
The - port(int) property value.

setPutMessageOptionsOptions

public void setPutMessageOptionsOptions(int options)

Sets PutMessageOptions Options field property (int) value.

Parameters:
options(int). - The PutMessageOptions options.

setQmgrName

public void setQmgrName(java.lang.String qmgrname)
Sets the QMgrName property (java.lang.String) value.
Parameters:
The - QMgrName(java.lang.String) property value.

setQmgrReply

public void setQmgrReply(java.lang.String newQmgrReply)
Sets the QmgrReply property (java.lang.String) value.
Parameters:
newQmgrReply - java.lang.String

setReplyQName

public void setReplyQName(java.lang.String rqname)
Sets the ReplyToQName property (java.lang.String) value.
Parameters:
The - replyToQName(java.lang.String) property value.

setReplyToQOpenOptions

public void setReplyToQOpenOptions(int options)

Sets ReplyToQOpenOptions field property (int) value.

Parameters:
options(int). - The ReplyToQ open options.

setSendQName

public void setSendQName(java.lang.String sqname)
Sets the SendToQName property (java.lang.String) value.
Parameters:
The - sendToQName(java.lang.String) property value.

setSendToQOpenOptions

public void setSendToQOpenOptions(int options)

Sets SendToQOpenOptions field property (int) value.

Parameters:
options(int). - The SendToQ open options.

setServer

public void setServer(boolean aBoolean)

Sets the server property (boolean) value.

Parameters:
aBoolean. - The new boolean value for the property.
See Also:
getAutomaticConnectionEstablishment()

setSynchronousMode

public void setSynchronousMode(boolean aSynchronousMode)

Sets the synchronousMode property (boolean) value.

Parameters:
aSynchronousMode - The new value for the property.
See Also:
getSynchronousMode()

setTimeBetweenRetries

public void setTimeBetweenRetries(int timeBetweenRetries)
Sets the timeBetweenRetries property (int) value.
Parameters:
timeBetweenRetries - The new value for the property.
See Also:
getTimeBetweenRetries()

setTimeout

public void setTimeout(int newTimeout)

Sets the timeout property value.

Parameters:
newTimeout - int
See Also:
getTimeout()

setUserId

public void setUserId(java.lang.String newUserId)
Sets the userId property (java.lang.String) value.
Parameters:
newUserId - java.lang.String

startChannel

public int startChannel(java.lang.String channelName)
                 throws com.ibm.mq.MQException

Starts the specified channel.

Parameters:
channelName - The name of the channel to be started.
Returns:
Returns code related to operation. Possible values are:
  • 0 : Success
  • 1 : Channel is in use
  • 2 : Fail
  • -1 : Operation not available
Throws:
com.ibm.mq.MQException. -  

stopChannel

public int stopChannel(java.lang.String channelName)
                throws com.ibm.mq.MQException

Stops the specified channel.

Parameters:
channelName - The name of the channel to be stopped.
Returns:
Returns code related to operation. Possible values are:
  • 0 : Success
  • 2 : Fail
  • -1 : Operation not available
Throws:
com.ibm.mq.MQException. -  

terminate

public void terminate()

Terminates the conversation. This method terminates the internal thread and closes the conversation ABNORMALY, if required (if in RECEIVE state).

Specified by:
terminate in interface MQConnectionService
Overrides:
terminate in class Service

toString

public java.lang.String toString()
Returns a visual representation of this object.
Overrides:
toString in class Service
Returns:
java.lang.String - The object visual representation.