com.ibm.mq
Class MQDestination
- java.lang.Object
- com.ibm.mq.jmqi.JmqiObject
- com.ibm.mq.MQManagedObject
- com.ibm.mq.MQDestination
Direct known subclasses:
- public abstract class MQDestination
- extends MQManagedObject
MQQueue
and
MQTopic
.
See Also:
Field Summary
Fields inherited from class com.ibm.mq.MQManagedObject |
---|
alternateUserId, closeOptions, connectionReference, isOpen, name, openOptions |
Fields inherited from class com.ibm.mq.jmqi.JmqiObject |
---|
COMP_JM, COMP_JN, COMP_JO |
Method Summary
Modifier and Type | Method and Description |
---|---|
|
get(MQMessage message)
Retrieves a message from the queue or topic.
|
|
get(MQMessage message,MQGetMessageOptions getMessageOptions)
Retrieves a message from the queue or topic.
|
|
get(MQMessage message,MQGetMessageOptions getMessageOptions,int maxMsgSize)
Retrieves a message from the queue or topic up to the maximum specified message size.
|
|
getCreationDateTime()
Gets the date and time that this destination was created.
|
|
getDestinationType()
Gets the type of destination this object represents.
|
|
getQueueManagerCmdLevel()
|
|
put(MQMessage message)
Places a message onto a queue or publishes a message to a topic.
|
|
put(MQMessage message,MQPutMessageOptions putMessageOptions)
Places a message onto a queue or publishes a message to a topic.
|
|
setQueueManagerCmdLevel(int queueManagerCmdLevel)
|
Methods inherited from class com.ibm.mq.MQManagedObject |
---|
close, getAlternateUserId, getAttributeString, getCloseOptions, getConnectionReference, getDescription, getName, getOpenOptions, getResolvedObjectString, getResolvedQName, getResolvedType, inquire, inquire, isOpen, set, setAttributeString, setCloseOptions |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail
get
- public void get(MQMessage message)
- throws MQException
Parameters:
message
- An input / output parameter containing the message descriptor information and
the returned message data. Throws:
MQException
- If the call fails. get
- public void get(MQMessage message,
- MQGetMessageOptions getMessageOptions)
- throws MQException
Retrieves a message from the queue or topic. This method takes an
MQMessage
object as a
parameter. It uses some of the fields in the object as input parameters, in particular the
messageId
and correlationId
, so it is important to ensure that these
are set as required.
If the get fails, the MQMessage object is unchanged. If it succeeds, the message descriptor
(member variables) and message data portions of the MQMessage are completely replaced with the
message descriptor and message data from the incoming message.
Parameters:
message
- An input / output parameter containing the message descriptor information and
the returned message data. getMessageOptions
- Options controlling the action of the get. Throws:
MQException
- If the call fails. get
- public void get(MQMessage message,
- MQGetMessageOptions getMessageOptions,
- int maxMsgSize)
- throws MQException
Retrieves a message from the queue or topic up to the maximum specified message size. This
method takes an
MQMessage
object as a parameter. It uses some of the fields in the
object as input parameters, in particular the messageId
and
correlationId
, so it is important to ensure that these are set as required.
If the get fails, the MQMessage object is unchanged. If it succeeds, the message descriptor
(member variables) and message data portions of the MQMessage are completely replaced with the
message descriptor and message data from the incoming message.
Parameters:
message
- An input / output parameter containing the message descriptor information and
the returned message data. getMessageOptions
- Options controlling the action of the get. maxMsgSize
- The largest message this method can receive. If the message on the queue is
larger than this size, once of two things occurs;
- If the {link CMQC#MQGMO_ACCEPT_TRUNCATED_MSG} flag is set in the
MQGetMessageOptions
object, the message is filled with as much of the message data as possible. An exception is thrown with theCMQC.MQCC_WARNING
completion code. - If the
CMQC.MQGMO_ACCEPT_TRUNCATED_MSG
flag is not set, the message is left on the queue or topic and an exception is thrown with theCMQC.MQCC_WARNING
completion code andCMQC.MQRC_TRUNCATED_MSG_FAILED
reason code.
Throws:
MQException
- If the call fails. put
- public void put(MQMessage message)
- throws MQException
Places a message onto a queue or publishes a message to a topic. This method uses a default
instance of
MQPutMessageOptions
to perform the put or publish. The default
MQPutMessageOptions instance may differ depending upon the destination type.
Parameters:
message
- An MQMessage
object containing the Message Descriptor data ( MQMD
) and message to be sent. The Message Descriptor properties of this object can be
altered as a result of this method. The values that they have immediately after the
completion of this method are the values that were put to the queue or published to
the topic. Throws:
MQException
- If the call fails. put
- public void put(MQMessage message,
- MQPutMessageOptions putMessageOptions)
- throws MQException
Places a message onto a queue or publishes a message to a topic.
Modifications to the MQMessage
object after the put has completed do not affect the
actual message on the destination.
If you use the same MQMessage object to make further calls, then performing a put updates
MQMD.messageId
and MQMD.correlationId
.
Note also that calling put(MQMessage, MQPutMessageOptions)
does not clear the message
data. For example:
msg.writeString("a"); destination.put(msg, pmo);
msg.writeString("b"); destination.put(msg, pmo);
This results in "ab" being put by the second call.
Parameters:
message
- An MQMessage object containing the Message Descriptor data ( MQMD
) and
message to be sent. The Message Descriptor properties of this object can be altered as
a result of this method. The values that they have immediately after the completion of
this method are the values that were put to the queue or published to the topic. putMessageOptions
- Options controlling the action of the put. Throws:
MQException
- If the call fails. getDestinationType
- public int getDestinationType()
Gets the type of destination this object represents. May be either
CMQC.MQOT_Q
or
CMQC.MQOT_TOPIC
.
Returns:
The destination type.
getCreationDateTime
- public java.util.GregorianCalendar getCreationDateTime( )
- throws MQException
Gets the date and time that this destination was created.
Returns:
the date and time.
Throws:
MQException
- if you call this method after you have closed the destination, to
indicate that the destination is no longer accessible. getQueueManagerCmdLevel
- public int getQueueManagerCmdLevel( )
Returns:
cmd level
setQueueManagerCmdLevel
- public void setQueueManagerCmdLevel( int queueManagerCmdLevel)
Parameters:
queueManagerCmdLevel
-
MQMessage
object as a parameter. It uses some of the fields in the object as input parameters, in particular themessageId
andcorrelationId
, so it is important to ensure that these are set as required. If the get fails, the MQMessage object is unchanged. If it succeeds, the message descriptor (member variables) and message data portions of the MQMessage are completely replaced with the message descriptor and message data from the incoming message. This method uses a default instance ofMQGetMessageOptions
to do the get. The message option used isCMQC.MQGMO_NO_WAIT
.