new JMSProducer()
This method is not meant to be used directly.
Creates a JMSProducer object that works for producing messages.
Method Summary
- clearProperties
- Clears any message properties set on this JMSProducer.
- getAsync
- Get the CompletionListener that has previously been configured.
- getDeliveryDelay
- Gets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
- getDeliveryMode
- Gets the producer's default delivery mode.
- getJMSCorrelationID
- Returns the JMSCorrelationID header value that has been set on this JMSProducer.
- getJMSReplyTo
- Returns the JMSReplyTo header value that has been set on this JMSProducer.
- getJMSType
- Returns the JMSType header value that has been set on this JMSProducer.
- getObjectProperty
- Returns the message property with the specified name that has been set on this JMSProducer.
- getPriority
- Gets the producer's default priority.
- getTimeToLive
- Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
- propertyExists
- Indicates whether a message property with the specified name has been set on this JMSProducer.
- send
- Sends a message to the specified destination, using any send options, message properties and message headers that have been defined on this JMSProducer.
- setAsync
- Specifies the CompletionListener to be called when the message has been successfully sent, or in case an error occurs.
- setDeliveryDelay
- Sets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
- setDeliveryMode
- Sets the producer's default delivery mode.
- setJMSCorrelationID
- Specifies that messages sent using this JMSProducer will have their JMSCorrelationID header value set to the specified correlation ID.
- setJMSReplyTo
- Specifies that messages sent using this JMSProducer will have their JMSReplyTo header value set to the specified Destination object.
- setJMSType
- Specifies that messages sent using this JMSProducer will have their JMSType header value set to the specified message type.
- setObjectProperty
- Specifies that messages sent using this JMSProducer will have the specified property set to the specified value.
- setPriority
- Sets the producer's default priority.
- setTimeToLive
- Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
Method Detail
-
clearProperties() → {JMSProducer}
-
Clears any message properties set on this JMSProducer.
Returns:
- Type
- JMSProducer
-
getAsync() → {CompletionListener}
-
Get the CompletionListener that has previously been configured.
Returns:
- Type
- CompletionListener
-
getDeliveryDelay() → {Number}
-
Gets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
Returns:
- Type
- Number
-
getDeliveryMode() → {String}
-
Gets the producer's default delivery mode.
Returns:
- Type
- String
-
getJMSCorrelationID() → {String}
-
Returns the JMSCorrelationID header value that has been set on this JMSProducer.
Returns:
- Type
- String
-
getJMSReplyTo() → {Destination}
-
Returns the JMSReplyTo header value that has been set on this JMSProducer.
Returns:
- Type
- Destination
-
getJMSType() → {String}
-
Returns the JMSType header value that has been set on this JMSProducer.
Returns:
- Type
- String
-
getObjectProperty(name) → {Object}
-
Returns the message property with the specified name that has been set on this JMSProducer.
Parameters:
Name Type Description name
String the name of the property. Returns:
- Type
- Object
-
getPriority() → {Number}
-
Gets the producer's default priority.
Returns:
- Type
- Number
-
getTimeToLive() → {Number}
-
Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
Returns:
- Type
- Number
-
propertyExists(name) → {Boolean}
-
Indicates whether a message property with the specified name has been set on this JMSProducer.
Parameters:
Name Type Description name
String the name of the property. Returns:
- Type
- Boolean
-
send(destination, body, classFQN) → {JMSProducer}
-
Sends a message to the specified destination, using any send options, message properties and message headers that have been defined on this JMSProducer.
This method may be called in different ways:- The body is a Message object: the message is sent to the specified destination, overwriting its options and properties only with those that have been set on this producer.
- The body is a String: creates and sends a TextMessage with the body as payload, using options and properties of this producer.
- The body is an object and classFQN is not specified : creates and sends a MapMessage with the body as payload, using options and properties of this producer.
- The body is an object and classFQN is specified : creates and sends an ObjectMessage with the body as payload and classFQN as its fully qualified class name, using options and properties of this producer.
- Any other type of body: assumes the body is an array of bytes, and creates and sends a BytesMessage with the body as payload, using options and properties of this producer.
Parameters:
Name Type Description destination
Destination specifies the destination of this message. body
Message | String | Object Message to be sent, or payload of a new message to be created and sent. classFQN
String in case the body is an Object and the message is intended as an ObjectMessage, specifies the fully qualified name of the object's class. Returns:
- Type
- JMSProducer
-
setAsync(completionListener) → {JMSProducer}
-
Specifies the CompletionListener to be called when the message has been successfully sent, or in case an error occurs.
Parameters:
Name Type Description completionListener
CompletionListener the listener to be called when the message has been successfully sent, or in case an error occurs. Returns:
- Type
- JMSProducer
-
setDeliveryDelay(deliveryDelay) → {JMSProducer}
-
Sets the minimum length of time in milliseconds that must elapse after a message is sent before the JMS provider may deliver the message to a consumer.
Parameters:
Name Type Description deliveryDelay
Number the delivery delay in milliseconds. Returns:
- Type
- JMSProducer
-
setDeliveryMode(deliveryMode) → {JMSProducer}
-
Sets the producer's default delivery mode.
Parameters:
Name Type Description deliveryMode
String specifies if by default messages must be delivered persistently or not persistently. It can either be "PERSISTENT"
or"NON_PERSISTENT"
. See JMS specifications for more information.Returns:
- Type
- JMSProducer
-
setJMSCorrelationID(correlationId) → {JMSProducer}
-
Specifies that messages sent using this JMSProducer will have their JMSCorrelationID header value set to the specified correlation ID.
Parameters:
Name Type Description correlationId
String the message ID of a message being referred to. Returns:
- Type
- JMSProducer
-
setJMSReplyTo(replyTo) → {JMSProducer}
-
Specifies that messages sent using this JMSProducer will have their JMSReplyTo header value set to the specified Destination object.
Parameters:
Name Type Description replyTo
Destination Destination to which to send a response to this message. Returns:
- Type
- JMSProducer
-
setJMSType(type) → {JMSProducer}
-
Specifies that messages sent using this JMSProducer will have their JMSType header value set to the specified message type.
Parameters:
Name Type Description type
String the message type Returns:
- Type
- JMSProducer
-
setObjectProperty(name, value) → {JMSProducer}
-
Specifies that messages sent using this JMSProducer will have the specified property set to the specified value.
Parameters:
Name Type Description name
String the name of the property. value
Object the object property value to set. Returns:
- Type
- JMSProducer
-
setPriority(priority) → {JMSProducer}
-
Sets the producer's default priority.
Parameters:
Name Type Description priority
Number specifies the default level of priority for messages sent with this producer. See JMS specifications for more information. Returns:
- Type
- JMSProducer
-
setTimeToLive(timeToLive) → {JMSProducer}
-
Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
Parameters:
Name Type Description timeToLive
Number specifies the default time to live for messages sent with this producer. Time to live directly influences message expiration. See JMS specifications for more information. Returns:
- Type
- JMSProducer