public abstract class ActiveMQMessageProducerSupport extends java.lang.Object implements javax.jms.MessageProducer, Closeable
MessageProducer| Modifier and Type | Field and Description |
|---|---|
protected int |
defaultDeliveryMode |
protected int |
defaultPriority |
protected long |
defaultTimeToLive |
protected boolean |
disableMessageID |
protected boolean |
disableMessageTimestamp |
protected int |
sendTimeout |
protected ActiveMQSession |
session |
| Constructor and Description |
|---|
ActiveMQMessageProducerSupport(ActiveMQSession session) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
checkClosed() |
int |
getDeliveryMode()
Gets the producer's default delivery mode.
|
boolean |
getDisableMessageID()
Gets an indication of whether message IDs are disabled.
|
boolean |
getDisableMessageTimestamp()
Gets an indication of whether message timestamps are disabled.
|
int |
getPriority()
Gets the producer's default priority.
|
int |
getSendTimeout() |
long |
getTimeToLive()
Gets the default length of time in milliseconds from its dispatch time
that a produced message should be retained by the message system.
|
void |
send(javax.jms.Destination destination,
javax.jms.Message message)
Sends a message to a destination for an unidentified message producer.
|
void |
send(javax.jms.Message message)
Sends a message using the
MessageProducer's default
delivery mode, priority, and time to live. |
void |
send(javax.jms.Message message,
int deliveryMode,
int priority,
long timeToLive)
Sends a message to the destination, specifying delivery mode, priority,
and time to live.
|
void |
setDeliveryMode(int newDeliveryMode)
Sets the producer's default delivery mode.
|
void |
setDisableMessageID(boolean value)
Sets whether message IDs are disabled.
|
void |
setDisableMessageTimestamp(boolean value)
Sets whether message timestamps are disabled.
|
void |
setPriority(int newDefaultPriority)
Sets the producer's default priority.
|
void |
setSendTimeout(int sendTimeout) |
void |
setTimeToLive(long timeToLive)
Sets the default length of time in milliseconds from its dispatch time
that a produced message should be retained by the message system.
|
protected ActiveMQSession session
protected boolean disableMessageID
protected boolean disableMessageTimestamp
protected int defaultDeliveryMode
protected int defaultPriority
protected long defaultTimeToLive
protected int sendTimeout
public ActiveMQMessageProducerSupport(ActiveMQSession session)
public void setDisableMessageID(boolean value)
throws javax.jms.JMSException
Since message IDs take some effort to create and increase a message's
size, some JMS providers may be able to optimize message overhead if
they are given a hint that the message ID is not used by an application.
By calling the setDisableMessageID method on this message
producer, a JMS client enables this potential optimization for all
messages sent by this message producer. If the JMS 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.
setDisableMessageID in interface javax.jms.MessageProducervalue - indicates if message IDs are disabledjavax.jms.JMSException - if the JMS provider fails to close the producer due to
some internal error.public boolean getDisableMessageID()
throws javax.jms.JMSException
getDisableMessageID in interface javax.jms.MessageProducerjavax.jms.JMSException - if the JMS provider fails to determine if message IDs are
disabled due to some internal error.public void setDisableMessageTimestamp(boolean value)
throws javax.jms.JMSException
Since timestamps take some effort to create and increase a message's
size, some JMS providers may be able to optimize message overhead if
they are given a hint that the timestamp is not used by an application.
By calling the setDisableMessageTimestamp method on this
message producer, a JMS client enables this potential optimization for
all messages sent by this message producer. 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.
setDisableMessageTimestamp in interface javax.jms.MessageProducervalue - indicates if message timestamps are disabledjavax.jms.JMSException - if the JMS provider fails to close the producer due to
some internal error.public boolean getDisableMessageTimestamp()
throws javax.jms.JMSException
getDisableMessageTimestamp in interface javax.jms.MessageProducerjavax.jms.JMSException - if the JMS provider fails to close the producer due to
some internal error.public void setDeliveryMode(int newDeliveryMode)
throws javax.jms.JMSException
Delivery mode is set to PERSISTENT by default.
setDeliveryMode in interface javax.jms.MessageProducernewDeliveryMode - the message delivery mode for this message producer; legal
values are DeliveryMode.NON_PERSISTENT and
DeliveryMode.PERSISTENTjavax.jms.JMSException - if the JMS provider fails to set the delivery mode due to
some internal error.MessageProducer.getDeliveryMode(),
DeliveryMode.NON_PERSISTENT,
DeliveryMode.PERSISTENT,
Message.DEFAULT_DELIVERY_MODEpublic int getDeliveryMode()
throws javax.jms.JMSException
getDeliveryMode in interface javax.jms.MessageProducerjavax.jms.JMSException - if the JMS provider fails to close the producer due to
some internal error.public void setPriority(int newDefaultPriority)
throws javax.jms.JMSException
The JMS 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.
setPriority in interface javax.jms.MessageProducernewDefaultPriority - the message priority for this message producer; must be a
value between 0 and 9javax.jms.JMSException - if the JMS provider fails to set the delivery mode due to
some internal error.MessageProducer.getPriority(),
Message.DEFAULT_PRIORITYpublic int getPriority()
throws javax.jms.JMSException
getPriority in interface javax.jms.MessageProducerjavax.jms.JMSException - if the JMS provider fails to close the producer due to
some internal error.MessageProducer.setPriority(int)public void setTimeToLive(long timeToLive)
throws javax.jms.JMSException
Time to live is set to zero by default.
setTimeToLive in interface javax.jms.MessageProducertimeToLive - the message time to live in milliseconds; zero is unlimitedjavax.jms.JMSException - if the JMS provider fails to set the time to live due to
some internal error.MessageProducer.getTimeToLive(),
Message.DEFAULT_TIME_TO_LIVEpublic long getTimeToLive()
throws javax.jms.JMSException
getTimeToLive in interface javax.jms.MessageProducerjavax.jms.JMSException - if the JMS provider fails to get the time to live due to
some internal error.MessageProducer.setTimeToLive(long)public void send(javax.jms.Message message)
throws javax.jms.JMSException
MessageProducer's default
delivery mode, priority, and time to live.send in interface javax.jms.MessageProducermessage - the message to sendjavax.jms.JMSException - if the JMS provider fails to send the message due to some
internal error.javax.jms.MessageFormatException - if an invalid message is specified.javax.jms.InvalidDestinationException - if a client uses this method with a
MessageProducer with an invalid destination.java.lang.UnsupportedOperationException - if a client uses this method with a
MessageProducer that did not specify a
destination at creation time.Session.createProducer(javax.jms.Destination),
MessageProducerpublic void send(javax.jms.Message message,
int deliveryMode,
int priority,
long timeToLive)
throws javax.jms.JMSException
send in interface javax.jms.MessageProducermessage - the message to senddeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)javax.jms.JMSException - if the JMS provider fails to send the message due to some
internal error.javax.jms.MessageFormatException - if an invalid message is specified.javax.jms.InvalidDestinationException - if a client uses this method with a
MessageProducer with an invalid destination.java.lang.UnsupportedOperationException - if a client uses this method with a
MessageProducer that did not specify a
destination at creation time.Session.createProducer(javax.jms.Destination)public void send(javax.jms.Destination destination,
javax.jms.Message message)
throws javax.jms.JMSException
MessageProducer's default delivery mode,
priority, and time to live.
Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.
send in interface javax.jms.MessageProducerdestination - the destination to send this message tomessage - the message to sendjavax.jms.JMSException - if the JMS provider fails to send the message due to some
internal error.javax.jms.MessageFormatException - if an invalid message is specified.javax.jms.InvalidDestinationException - if a client uses this method with an invalid destination.java.lang.UnsupportedOperationException - if a client uses this method with a
MessageProducer that specified a destination at
creation time.Session.createProducer(javax.jms.Destination),
MessageProducerprotected abstract void checkClosed()
throws javax.jms.IllegalStateException
javax.jms.IllegalStateExceptionpublic int getSendTimeout()
public void setSendTimeout(int sendTimeout)
sendTimeout - the sendTimeout to setCopyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.