Class ActiveMQJMSProducer
- All Implemented Interfaces:
JMSProducer
setDisableMessageID(boolean) and setDisableMessageTimestamp(boolean)
calls their equivalent at the MessageProducer. IF the user is using the producer in async mode, this may lead
to races. We allow/tolerate this because these are just optional optimizations.-
Method Summary
Modifier and TypeMethodDescriptionClears any message properties set on thisJMSProducergetAsync()If subsequent calls tosendon thisJMSProducerobject have been configured to be asynchronous then this method returns theCompletionListenerthat has previously been configured.booleangetBooleanProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to aboolean.bytegetByteProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to aString.longGets the minimum length of time in milliseconds that must elapse after a message is sent before the Jakarta Messaging provider may deliver the message to a consumer.intReturns the delivery mode of messages that are sent using thisJMSProducerbooleanGets an indication of whether message IDs are disabled.booleanGets an indication of whether message timestamps are disabled.doublegetDoubleProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to adouble.floatgetFloatProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to afloat.intgetIntProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to aint.Returns theJMSCorrelationIDheader value that has been set on thisJMSProducer, as aString.byte[]Returns theJMSCorrelationIDheader value that has been set on thisJMSProducer, as an array of bytes.Returns theJMSReplyToheader value that has been set on thisJMSProducer.Returns theJMSTypeheader value that has been set on thisJMSProducer.longgetLongProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to along.getObjectProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to objectified format.intReturn the priority of messages that are sent using thisJMSProducerReturns an unmodifiableSetview of the names of all the message properties that have been set on this JMSProducer.shortgetShortProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to ashort.getStringProperty(String name) Returns the message property with the specified name that has been set on thisJMSProducer, converted to aString.longReturns the time to live of messages that are sent using thisJMSProducer.booleanpropertyExists(String name) Indicates whether a message property with the specified name has been set on thisJMSProducersend(Destination destination, byte[] body) Send aBytesMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.send(Destination destination, Message message) Sends a message to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.send(Destination destination, Serializable body) Send anObjectMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.send(Destination destination, String body) Send aTextMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.send(Destination destination, Map<String, Object> body) Send aMapMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.setAsync(CompletionListener completionListener) Specifies whether subsequent calls tosendon thisJMSProducerobject should be synchronous or asynchronous.setDeliveryDelay(long deliveryDelay) Sets the minimum length of time in milliseconds that must elapse after a message is sent before the Jakarta Messaging provider may deliver the message to a consumer.setDeliveryMode(int deliveryMode) Specifies the delivery mode of messages that are sent using thisJMSProducersetDisableMessageID(boolean value) Specifies whether message IDs may be disabled for messages that are sent using thisJMSProducersetDisableMessageTimestamp(boolean value) Specifies whether message timestamps may be disabled for messages that are sent using thisJMSProducer.setJMSCorrelationID(String correlationID) Specifies that messages sent using thisJMSProducerwill have theirJMSCorrelationIDheader value set to the specified correlation ID, where correlation ID is specified as aString.setJMSCorrelationIDAsBytes(byte[] correlationID) Specifies that messages sent using thisJMSProducerwill have theirJMSCorrelationIDheader value set to the specified correlation ID, where correlation ID is specified as an array of bytes.setJMSReplyTo(Destination replyTo) Specifies that messages sent using thisJMSProducerwill have theirJMSReplyToheader value set to the specifiedDestinationobject.setJMSType(String type) Specifies that messages sent using thisJMSProducerwill have theirJMSTypeheader value set to the specified message type.setPriority(int priority) Specifies the priority of messages that are sent using thisJMSProducersetProperty(String name, boolean value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedbooleanvalue.setProperty(String name, byte value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedbytevalue.setProperty(String name, double value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifieddoublevalue.setProperty(String name, float value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedfloatvalue.setProperty(String name, int value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedintvalue.setProperty(String name, long value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedlongvalue.setProperty(String name, short value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedshortvalue.setProperty(String name, Object value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specified Java object value.setProperty(String name, String value) Specifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedStringvalue.setTimeToLive(long timeToLive) Specifies the time to live of messages that are sent using thisJMSProducer.
-
Method Details
-
send
Description copied from interface:JMSProducerSends a message to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.- Specified by:
sendin interfaceJMSProducer- Parameters:
destination- the destination to send this message tomessage- the message to send- Returns:
- this
JMSProducer
-
send
Description copied from interface:JMSProducerSend aTextMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.- Specified by:
sendin interfaceJMSProducer- Parameters:
destination- the destination to send this message tobody- the body of theTextMessagethat will be sent. If a null value is specified then aTextMessagewith no body will be sent.- Returns:
- this
JMSProducer
-
send
Description copied from interface:JMSProducerSend aMapMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.- Specified by:
sendin interfaceJMSProducer- Parameters:
destination- the destination to send this message tobody- the body of theMapMessagethat will be sent. If a null value is specified then aMapMessagewith no map entries will be sent.- Returns:
- this
JMSProducer
-
send
Description copied from interface:JMSProducerSend aBytesMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.- Specified by:
sendin interfaceJMSProducer- Parameters:
destination- the destination to send this message tobody- the body of theBytesMessagethat will be sent. If a null value is specified then aBytesMessagewith no body will be sent.- Returns:
- this
JMSProducer
-
send
Description copied from interface:JMSProducerSend anObjectMessagewith the specified body to the specified destination, using any send options, message properties and message headers that have been defined on thisJMSProducer.- Specified by:
sendin interfaceJMSProducer- Parameters:
destination- the destination to send this message tobody- the body of the ObjectMessage that will be sent. If a null value is specified then anObjectMessagewith no body will be sent.- Returns:
- this
JMSProducer
-
setDisableMessageID
Description copied from interface:JMSProducerSpecifies whether message IDs may be disabled for messages that are sent using thisJMSProducerSince message IDs take some effort to create and increase a message's size, some Jakarta Messaging providers may be able to optimise message overhead if they are given a hint that the message ID is not used by an application. By calling this method, a Jakarta Messaging application enables this potential optimisation for all messages sent using this
JMSProducer. If the Jakarta Messaging provider accepts this hint, these messages must have the message ID set to null; if the provider ignores the hint, the message ID must be set to its normal unique value.Message IDs are enabled by default.
- Specified by:
setDisableMessageIDin interfaceJMSProducer- Parameters:
value- indicates whether message IDs may be disabled- Returns:
- this
JMSProducer - See Also:
-
getDisableMessageID
public boolean getDisableMessageID()Description copied from interface:JMSProducerGets an indication of whether message IDs are disabled.- Specified by:
getDisableMessageIDin interfaceJMSProducer- Returns:
- an indication of whether message IDs are disabled
- See Also:
-
setDisableMessageTimestamp
Description copied from interface:JMSProducerSpecifies whether message timestamps may be disabled for messages that are sent using thisJMSProducer.Since timestamps take some effort to create and increase a message's size, some Jakarta Messaging providers may be able to optimise message overhead if they are given a hint that the timestamp is not used by an application. By calling this method, a Jakarta Messaging application enables this potential optimisation for all messages sent using this
JMSProducer. If the JMS provider accepts this hint, these messages must have the timestamp set to zero; if the provider ignores the hint, the timestamp must be set to its normal value.Message timestamps are enabled by default.
- Specified by:
setDisableMessageTimestampin interfaceJMSProducer- Parameters:
value- indicates whether message timestamps may be disabled- Returns:
- this
JMSProducer - See Also:
-
getDisableMessageTimestamp
public boolean getDisableMessageTimestamp()Description copied from interface:JMSProducerGets an indication of whether message timestamps are disabled.- Specified by:
getDisableMessageTimestampin interfaceJMSProducer- Returns:
- an indication of whether message timestamps are disabled
- See Also:
-
setDeliveryMode
Description copied from interface:JMSProducerSpecifies the delivery mode of messages that are sent using thisJMSProducerDelivery mode is set to
PERSISTENTby default.- Specified by:
setDeliveryModein interfaceJMSProducer- Parameters:
deliveryMode- the message delivery mode to be used; legal values areDeliveryMode.NON_PERSISTENTandDeliveryMode.PERSISTENT- Returns:
- this
JMSProducer - See Also:
-
getDeliveryMode
public int getDeliveryMode()Description copied from interface:JMSProducerReturns the delivery mode of messages that are sent using thisJMSProducer- Specified by:
getDeliveryModein interfaceJMSProducer- Returns:
- the message delivery mode
- See Also:
-
setPriority
Description copied from interface:JMSProducerSpecifies the priority of messages that are sent using thisJMSProducerThe Jakarta Messaging API defines ten levels of priority value, with 0 as the lowest priority and 9 as the highest. Clients should consider priorities 0-4 as gradations of normal priority and priorities 5-9 as gradations of expedited priority. Priority is set to 4 by default.
- Specified by:
setPriorityin interfaceJMSProducer- Parameters:
priority- the message priority to be used; must be a value between 0 and 9- Returns:
- this
JMSProducer - See Also:
-
getPriority
public int getPriority()Description copied from interface:JMSProducerReturn the priority of messages that are sent using thisJMSProducer- Specified by:
getPriorityin interfaceJMSProducer- Returns:
- the message priority
- See Also:
-
setTimeToLive
Description copied from interface:JMSProducerSpecifies the time to live of messages that are sent using thisJMSProducer. This is used to determine the expiration time of a message.The expiration time of a message is the sum of the message's time to live and the time it is sent. For transacted sends, this is the time the client sends the message, not the time the transaction is committed.
Clients should not receive messages that have expired; however, Jakarta Messaging does not guarantee that this will not happen.
A Jakarta Messaging provider should do its best to accurately expire messages; however, Jakarta Messaging does not define the accuracy provided. It is not acceptable to simply ignore time-to-live.
Time to live is set to zero by default, which means a message never expires.
- Specified by:
setTimeToLivein interfaceJMSProducer- Parameters:
timeToLive- the message time to live to be used, in milliseconds; a value of zero means that a message never expires.- Returns:
- this
JMSProducer - See Also:
-
getTimeToLive
public long getTimeToLive()Description copied from interface:JMSProducerReturns the time to live of messages that are sent using thisJMSProducer.- Specified by:
getTimeToLivein interfaceJMSProducer- Returns:
- the message time to live in milliseconds; a value of zero means that a message never expires.
- See Also:
-
setDeliveryDelay
Description copied from interface:JMSProducerSets the minimum length of time in milliseconds that must elapse after a message is sent before the Jakarta Messaging provider may deliver the message to a consumer.For transacted sends, this time starts when the client sends the message, not when the transaction is committed.
deliveryDelay is set to zero by default.
- Specified by:
setDeliveryDelayin interfaceJMSProducer- Parameters:
deliveryDelay- the delivery delay in milliseconds.- Returns:
- this
JMSProducer - See Also:
-
getDeliveryDelay
public long getDeliveryDelay()Description copied from interface:JMSProducerGets the minimum length of time in milliseconds that must elapse after a message is sent before the Jakarta Messaging provider may deliver the message to a consumer.- Specified by:
getDeliveryDelayin interfaceJMSProducer- Returns:
- the delivery delay in milliseconds.
- See Also:
-
setAsync
Description copied from interface:JMSProducerSpecifies whether subsequent calls tosendon thisJMSProducerobject should be synchronous or asynchronous. If the specifiedCompletionListeneris not null then subsequent calls tosendwill be asynchronous. If the specifiedCompletionListeneris null then subsequent calls tosendwill be synchronous. Calls tosendare synchronous by default.If a call to
sendis asynchronous then part of the work involved in sending the message will be performed in a separate thread and the specified CompletionListener will be notified when the operation has completed.When the message has been successfully sent the Jakarta Messaging provider invokes the callback method onCompletion on the CompletionListener object. Only when that callback has been invoked can the application be sure that the message has been successfully sent with the same degree of confidence as if the send had been synchronous. An application which requires this degree of confidence must therefore wait for the callback to be invoked before continuing.
The following information is intended to give an indication of how an asynchronous send would typically be implemented.
In some Jakarta Messaging providers, a normal synchronous send involves sending the message to a remote Jakarta Messaging server and then waiting for an acknowledgement to be received before returning. It is expected that such a provider would implement an asynchronous send by sending the message to the remote Jakarta Messaging server and then returning without waiting for an acknowledgement. When the acknowledgement is received, the Jakarta Messaging provider would notify the application by invoking the onCompletion method on the application-specified CompletionListener object. If for some reason the acknowledgement is not received the Jakarta Messaging provider would notify the application by invoking the CompletionListener's onException method.
In those cases where the Jakarta Messaging specification permits a lower level of reliability, a normal synchronous send might not wait for an acknowledgement. In that case it is expected that an asynchronous send would be similar to a synchronous send: the Jakarta Messaging provider would send the message to the remote Jakarta Messaging server and then return without waiting for an acknowledgement. However the Jakarta Messaging provider would still notify the application that the send had completed by invoking the onCompletion method on the application-specified CompletionListener object.
It is up to the Jakarta Messaging provider to decide exactly what is performed in the calling thread and what, if anything, is performed asynchronously, so long as it satisfies the requirements given below:
Quality of service: After the send operation has completed successfully, which means that the message has been successfully sent with the same degree of confidence as if a normal synchronous send had been performed, the JMS provider must invoke the CompletionListener's onCompletion method. The CompletionListener must not be invoked earlier than this.
Exceptions: If an exception is encountered during the call to the send method then an appropriate exception should be thrown in the thread that is calling the send method. In this case the Jakarta Messaging provider must not invoke the CompletionListener's onCompletion or onException method. If an exception is encountered which cannot be thrown in the thread that is calling the send method then the Jakarta Messaging provider must call the CompletionListener's onException method. In both cases if an exception occurs it is undefined whether or not the message was successfully sent.
Message order: If the same JMSContext is used to send multiple messages then Jakarta Messaging message ordering requirements must be satisfied. This applies even if a combination of synchronous and asynchronous sends has been performed. The application is not required to wait for an asynchronous send to complete before sending the next message.
Close, commit or rollback: If the close method is called on the JMSContext then the JMS provider must block until any incomplete send operations have been completed and all
CompletionListenercallbacks have returned before closing the object and returning. If the session is transacted (uses a local transaction) then when the JMSContext's commit or rollback method is called the JMS provider must block until any incomplete send operations have been completed and allCompletionListenercallbacks have returned before performing the commit or rollback. Incomplete sends should be allowed to complete normally unless an error occurs.A CompletionListener callback method must not call close, commit or rollback on its own JMSContext. Doing so will cause the close, commit or rollback to throw an IllegalStateRuntimeException.
Restrictions on usage in Jakarta EE This method must not be used in a Jakarta EE EJB or web container. Doing so may cause a
JMSRuntimeExceptionto be thrown though this is not guaranteed.Message headers Jakarta Messaging defines a number of message header fields and message properties which must be set by the "Jakarta Messaging provider on send". If the send is asynchronous these fields and properties may be accessed on the sending client only after the CompletionListener has been invoked. If the CompletionListener's onException method is called then the state of these message header fields and properties is undefined.
Restrictions on threading: Applications that perform an asynchronous send must confirm to the threading restrictions defined in JMS. This means that the session may be used by only one thread at a time.
Setting a CompletionListener does not cause the session to be dedicated to the thread of control which calls the CompletionListener. The application thread may therefore continue to use the session after performing an asynchronous send. However the CompletionListener's callback methods must not use the session if an application thread might be using the session at the same time.
Use of the CompletionListener by the Jakarta Messaging provider: A session will only invoke one CompletionListener callback method at a time. For a given JMSContext, callbacks (both
onCompletionandonException) will be performed in the same order as the corresponding calls to the send method. A Jakarta Messaging provider must not invoke the CompletionListener from the thread that is calling the send method.Restrictions on the use of the Message object: Applications which perform an asynchronous send must take account of the restriction that a Message object is designed to be accessed by one logical thread of control at a time and does not support concurrent use.
After the send method has returned, the application must not attempt to read the headers, properties or body of the Message object until the CompletionListener's onCompletion or onException method has been called. This is because the Jakarta Messaging provider may be modifying the Message object in another thread during this time. The Jakarta Messaging provider may throw an JMSException if the application attempts to access or modify the Message object after the send method has returned and before the CompletionListener has been invoked. If the Jakarta Messaging provider does not throw an exception then the behaviour is undefined.
- Specified by:
setAsyncin interfaceJMSProducer- Parameters:
completionListener- If asynchronous send behaviour is required, this should be set to aCompletionListenerto be notified when the send has completed. If synchronous send behaviour is required, this should be set tonull.- Returns:
- this
JMSProducer - See Also:
-
getAsync
Description copied from interface:JMSProducerIf subsequent calls tosendon thisJMSProducerobject have been configured to be asynchronous then this method returns theCompletionListenerthat has previously been configured. If subsequent calls tosendhave been configured to be synchronous then this method returnsnull.- Specified by:
getAsyncin interfaceJMSProducer- Returns:
- the
CompletionListenerornull - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedbooleanvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- thebooleanvalue to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedbytevalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- thebytevalue to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedshortvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- theshortproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedintvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- theintproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedlongvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- thelongproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedfloatvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- thefloatproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifieddoublevalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- thedoubleproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specifiedStringvalue.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- theStringproperty value to set- Returns:
- this
JMSProducer - See Also:
-
setProperty
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have the specified property set to the specified Java object value.Note that this method works only for the objectified primitive object types (
Integer,Double,Long...) andStringobjects.This will replace any property of the same name that is already set on the message being sent.
- Specified by:
setPropertyin interfaceJMSProducer- Parameters:
name- the name of the propertyvalue- the Java object property value to set- Returns:
- this
JMSProducer - See Also:
-
clearProperties
Description copied from interface:JMSProducerClears any message properties set on thisJMSProducer- Specified by:
clearPropertiesin interfaceJMSProducer- Returns:
- this
JMSProducer
-
propertyExists
Description copied from interface:JMSProducerIndicates whether a message property with the specified name has been set on thisJMSProducer- Specified by:
propertyExistsin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- true whether the property exists
-
getBooleanProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to aboolean.- Specified by:
getBooleanPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
boolean - See Also:
-
getByteProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to aString.- Specified by:
getBytePropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
byte - See Also:
-
getShortProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to ashort.- Specified by:
getShortPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
short - See Also:
-
getIntProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to aint.- Specified by:
getIntPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
int - See Also:
-
getLongProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to along.- Specified by:
getLongPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
long - See Also:
-
getFloatProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to afloat.- Specified by:
getFloatPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
float - See Also:
-
getDoubleProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to adouble.- Specified by:
getDoublePropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
double - See Also:
-
getStringProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to aString.- Specified by:
getStringPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the property value, converted to a
boolean; if there is no property by this name, a null value is returned - See Also:
-
getObjectProperty
Description copied from interface:JMSProducerReturns the message property with the specified name that has been set on thisJMSProducer, converted to objectified format.This method can be used to return, in objectified format, an object that has been stored as a property in the message with the equivalent
setObjectPropertymethod call, or its equivalent primitivesettypePropertymethod.- Specified by:
getObjectPropertyin interfaceJMSProducer- Parameters:
name- the name of the property- Returns:
- the Java object property value with the specified name, in objectified format (for example, if the property
was set as an
int, anIntegeris returned); if there is no property by this name, a null value is returned - See Also:
-
getPropertyNames
Description copied from interface:JMSProducerReturns an unmodifiableSetview of the names of all the message properties that have been set on this JMSProducer.Note that Jakarta Messaging standard header fields are not considered properties and are not returned in this Set.
The set is backed by the
JMSProducer, so changes to the map are reflected in the set. However the set may not be modified. Attempts to modify the returned collection, whether directly or via its iterator, will result in anjava.lang.UnsupportedOperationException. Its behaviour matches that defined in thejava.util.CollectionsmethodunmodifiableSet.- Specified by:
getPropertyNamesin interfaceJMSProducer- Returns:
- a
Setcontaining the names of all the message properties that have been set on thisJMSProducer - See Also:
-
setJMSCorrelationIDAsBytes
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have theirJMSCorrelationIDheader value set to the specified correlation ID, where correlation ID is specified as an array of bytes.This will override any
JMSCorrelationIDheader value that is already set on the message being sent.The array is copied before the method returns, so future modifications to the array will not alter the value in this
JMSProducer.If a provider supports the native concept of correlation ID, a Jakarta Messaging client may need to assign specific
JMSCorrelationIDvalues to match those expected by native messaging clients. Jakarta Messaging providers without native correlation ID values are not required to support this method and its corresponding get method; their implementation may throw ajava.lang.UnsupportedOperationException.The use of a
byte[]value forJMSCorrelationIDis non-portable.- Specified by:
setJMSCorrelationIDAsBytesin interfaceJMSProducer- Parameters:
correlationID- the correlation ID value as an array of bytes- Returns:
- this
JMSProducer - See Also:
-
getJMSCorrelationIDAsBytes
public byte[] getJMSCorrelationIDAsBytes()Description copied from interface:JMSProducerReturns theJMSCorrelationIDheader value that has been set on thisJMSProducer, as an array of bytes.The use of a
byte[]value forJMSCorrelationIDis non-portable.- Specified by:
getJMSCorrelationIDAsBytesin interfaceJMSProducer- Returns:
- the correlation ID as an array of bytes
- See Also:
-
setJMSCorrelationID
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have theirJMSCorrelationIDheader value set to the specified correlation ID, where correlation ID is specified as aString.This will override any
JMSCorrelationIDheader value that is already set on the message being sent.A client can use the
JMSCorrelationIDheader field to link one message with another. A typical use is to link a response message with its request message.JMSCorrelationIDcan hold one of the following:- A provider-specific message ID
- An application-specific
String - A provider-native
byte[]value
Since each message sent by a Jakarta Messaging provider is assigned a message ID value, it is convenient to link messages via message ID. All message ID values must start with the
'ID:'prefix.In some cases, an application (made up of several clients) needs to use an application-specific value for linking messages. For instance, an application may use
JMSCorrelationIDto hold a value referencing some external information. Application-specified values must not start with the'ID:'prefix; this is reserved for provider-generated message ID values.If a provider supports the native concept of correlation ID, a Jakarta Messaging client may need to assign specific
JMSCorrelationIDvalues to match those expected by clients that do not use the Jakarta Messaging API. Abyte[]value is used for this purpose. Jakarta Messaging providers without native correlation ID values are not required to supportbyte[]values. The use of abyte[]value forJMSCorrelationIDis non-portable.- Specified by:
setJMSCorrelationIDin interfaceJMSProducer- Parameters:
correlationID- the message ID of a message being referred to- Returns:
- this
JMSProducer - See Also:
-
getJMSCorrelationID
Description copied from interface:JMSProducerReturns theJMSCorrelationIDheader value that has been set on thisJMSProducer, as aString.This method is used to return correlation ID values that are either provider-specific message IDs or application-specific
Stringvalues.- Specified by:
getJMSCorrelationIDin interfaceJMSProducer- Returns:
- the correlation ID of a message as a
String - See Also:
-
setJMSType
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have theirJMSTypeheader value set to the specified message type.This will override any
JMSTypeheader value that is already set on the message being sent.Some Jakarta Messaging providers use a message repository that contains the definitions of messages sent by applications. The
JMSTypeheader field may reference a message's definition in the provider's repository.The Jakarta Messaging API does not define a standard message definition repository, nor does it define a naming policy for the definitions it contains.
Some messaging systems require that a message type definition for each application message be created and that each message specify its type. In order to work with such Jakarta Messaging providers, Jakarta Messaging clients should assign a value to
JMSType, whether the application makes use of it or not. This ensures that the field is properly set for those providers that require it.To ensure portability, Jakarta Messaging clients should use symbolic values for
JMSTypethat can be configured at installation time to the values defined in the current provider's message repository. If string literals are used, they may not be valid type names for some Jakarta Messaging providers.- Specified by:
setJMSTypein interfaceJMSProducer- Parameters:
type- the message type- Returns:
- this
JMSProducer - See Also:
-
getJMSType
Description copied from interface:JMSProducerReturns theJMSTypeheader value that has been set on thisJMSProducer.- Specified by:
getJMSTypein interfaceJMSProducer- Returns:
- the message type
- See Also:
-
setJMSReplyTo
Description copied from interface:JMSProducerSpecifies that messages sent using thisJMSProducerwill have theirJMSReplyToheader value set to the specifiedDestinationobject.This will override any
JMSReplyToheader value that is already set on the message being sent.The
JMSReplyToheader field contains the destination where a reply to the current message should be sent. If it is null, no reply is expected. The destination may be either aQueueobject or aTopicobject.Messages sent with a null
JMSReplyTovalue may be a notification of some event, or they may just be some data the sender thinks is of interest.Messages with a
JMSReplyTovalue typically expect a response. A response is optional; it is up to the client to decide. These messages are called requests. A message sent in response to a request is called a reply.In some cases a client may wish to match a request it sent earlier with a reply it has just received. The client can use the
JMSCorrelationIDheader field for this purpose.- Specified by:
setJMSReplyToin interfaceJMSProducer- Parameters:
replyTo-Destinationto which to send a response to this message- Returns:
- this
JMSProducer - See Also:
-
getJMSReplyTo
Description copied from interface:JMSProducerReturns theJMSReplyToheader value that has been set on thisJMSProducer.- Specified by:
getJMSReplyToin interfaceJMSProducer- Returns:
DestinationtheJMSReplyToheader value- See Also:
-