public class HornetQMessageProducer extends Object implements MessageProducer, QueueSender, TopicPublisher
| Modifier | Constructor and Description |
|---|---|
protected |
HornetQMessageProducer(HornetQConnection jbossConn,
ClientProducer producer,
HornetQDestination defaultDestination,
ClientSession clientSession) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the message producer.
|
int |
getDeliveryMode()
Gets the producer's default delivery mode.
|
Destination |
getDestination()
Gets the destination associated with this
MessageProducer. |
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.
|
Queue |
getQueue()
Gets the queue associated with this
QueueSender. |
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.
|
Topic |
getTopic()
Gets the topic associated with this
TopicPublisher. |
void |
publish(Message message)
Publishes a message to the topic.
|
void |
publish(Message message,
int deliveryMode,
int priority,
long timeToLive)
Publishes a message to the topic, specifying delivery mode,
priority, and time to live.
|
void |
publish(Topic topic,
Message message)
Publishes a message to a topic for an unidentified message producer.
|
void |
publish(Topic topic,
Message message,
int deliveryMode,
int priority,
long timeToLive)
Publishes a message to a topic for an unidentified message
producer, specifying delivery mode, priority and time to live.
|
void |
send(Destination destination,
Message message)
Sends a message to a destination for an unidentified message producer.
|
void |
send(Destination destination,
Message message,
int deliveryMode,
int priority,
long timeToLive)
Sends a message to a destination for an unidentified message producer,
specifying delivery mode, priority and time to live.
|
void |
send(Message message)
Sends a message using the
MessageProducer's
default delivery mode, priority, and time to live. |
void |
send(Message message,
int deliveryMode,
int priority,
long timeToLive)
Sends a message to the destination, specifying delivery mode, priority, and
time to live.
|
void |
send(Queue queue,
Message message)
Sends a message to a queue for an unidentified message producer.
|
void |
send(Queue queue,
Message message,
int deliveryMode,
int priority,
long timeToLive)
Sends a message to a queue for an unidentified message producer,
specifying delivery mode, priority and time to live.
|
void |
setDeliveryMode(int deliveryMode)
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 defaultPriority)
Sets the producer's default priority.
|
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.
|
String |
toString() |
protected HornetQMessageProducer(HornetQConnection jbossConn, ClientProducer producer, HornetQDestination defaultDestination, ClientSession clientSession) throws JMSException
JMSExceptionpublic void setDisableMessageID(boolean value)
throws JMSException
MessageProducerSince 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 MessageProducervalue - indicates if message IDs are disabledJMSException - if the JMS provider fails to set message ID to
disabled due to some internal error.public boolean getDisableMessageID()
throws JMSException
MessageProducergetDisableMessageID in interface MessageProducerJMSException - if the JMS provider fails to determine if
message IDs are disabled due to some internal
error.public void setDisableMessageTimestamp(boolean value)
throws JMSException
MessageProducerSince 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 MessageProducervalue - indicates if message timestamps are disabledJMSException - if the JMS provider fails to set timestamps to
disabled due to some internal error.public boolean getDisableMessageTimestamp()
throws JMSException
MessageProducergetDisableMessageTimestamp in interface MessageProducerJMSException - if the JMS provider fails to determine if
timestamps are disabled due to some internal
error.public void setDeliveryMode(int deliveryMode)
throws JMSException
MessageProducerDelivery mode is set to PERSISTENT by default.
setDeliveryMode in interface MessageProducerdeliveryMode - the message delivery mode for this message
producer; legal values are DeliveryMode.NON_PERSISTENT
and DeliveryMode.PERSISTENTJMSException - 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 JMSException
MessageProducergetDeliveryMode in interface MessageProducerJMSException - if the JMS provider fails to get the delivery
mode due to some internal error.MessageProducer.setDeliveryMode(int)public void setPriority(int defaultPriority)
throws JMSException
MessageProducerThe 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 MessageProducerdefaultPriority - the message priority for this message producer;
must be a value between 0 and 9JMSException - if the JMS provider fails to set the priority
due to some internal error.MessageProducer.getPriority(),
Message.DEFAULT_PRIORITYpublic int getPriority()
throws JMSException
MessageProducergetPriority in interface MessageProducerJMSException - if the JMS provider fails to get the priority
due to some internal error.MessageProducer.setPriority(int)public void setTimeToLive(long timeToLive)
throws JMSException
MessageProducerTime to live is set to zero by default.
setTimeToLive in interface MessageProducertimeToLive - the message time to live in milliseconds; zero is
unlimitedJMSException - 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 JMSException
MessageProducergetTimeToLive in interface MessageProducerJMSException - if the JMS provider fails to get the time to
live due to some internal error.MessageProducer.setTimeToLive(long)public Destination getDestination() throws JMSException
MessageProducerMessageProducer.getDestination in interface MessageProducerDestination/JMSException - if the JMS provider fails to get the destination for
this MessageProducer
due to some internal error.public void close()
throws JMSException
MessageProducerSince a provider may allocate some resources on behalf of a
MessageProducer outside the Java virtual machine, clients
should close them when they
are not needed. Relying on garbage collection to eventually reclaim
these resources may not be timely enough.
close in interface MessageProducerJMSException - if the JMS provider fails to close the producer
due to some internal error.public void send(Message message) throws JMSException
MessageProducerMessageProducer's
default delivery mode, priority, and time to live.send in interface MessageProducersend in interface QueueSendermessage - the message to sendJMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with a MessageProducer with
an invalid destination.Session.createProducer(javax.jms.Destination),
MessageProducerpublic void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
MessageProducersend in interface MessageProducersend in interface QueueSendermessage - the message to senddeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)JMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with a MessageProducer with
an invalid destination.Session.createProducer(javax.jms.Destination)public void send(Destination destination, Message message) throws JMSException
MessageProducerMessageProducer'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 MessageProducerdestination - the destination to send this message tomessage - the message to sendJMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid destination.Session.createProducer(javax.jms.Destination),
MessageProducerpublic void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
MessageProducerTypically, 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 MessageProducerdestination - the destination to send this message tomessage - the message to senddeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)JMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid destination.Session.createProducer(javax.jms.Destination)public Topic getTopic() throws JMSException
TopicPublisherTopicPublisher.getTopic in interface TopicPublisherJMSException - if the JMS provider fails to get the topic for
this TopicPublisher
due to some internal error.public void publish(Message message) throws JMSException
TopicPublisherTopicPublisher's default delivery mode, priority,
and time to live.publish in interface TopicPublishermessage - the message to publishJMSException - if the JMS provider fails to publish the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses this method
with a TopicPublisher with
an invalid topic.MessageProducer.getDeliveryMode(),
MessageProducer.getTimeToLive(),
MessageProducer.getPriority()public void publish(Topic topic, Message message) throws JMSException
TopicPublisherTopicPublisher's default delivery mode,
priority, and time to live.
Typically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified message producers, which require that the topic be supplied every time a message is published.
publish in interface TopicPublishertopic - the topic to publish this message tomessage - the message to publishJMSException - if the JMS provider fails to publish the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid topic.MessageProducer.getDeliveryMode(),
MessageProducer.getTimeToLive(),
MessageProducer.getPriority()public void publish(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
TopicPublisherpublish in interface TopicPublishermessage - the message to publishdeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)JMSException - if the JMS provider fails to publish the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses this method
with a TopicPublisher with
an invalid topic.public void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
TopicPublisherTypically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified message producers, which require that the topic be supplied every time a message is published.
publish in interface TopicPublishertopic - the topic to publish this message tomessage - the message to publishdeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)JMSException - if the JMS provider fails to publish the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid topic.public void send(Queue queue, Message message) throws JMSException
QueueSenderQueueSender's default delivery mode, priority,
and time to live.
Typically, a message producer is assigned a queue at creation time; however, the JMS API also supports unidentified message producers, which require that the queue be supplied every time a message is sent.
send in interface QueueSenderqueue - the queue to send this message tomessage - the message to sendJMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid queue.MessageProducer.getDeliveryMode(),
MessageProducer.getTimeToLive(),
MessageProducer.getPriority()public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
QueueSenderTypically, a message producer is assigned a queue at creation time; however, the JMS API also supports unidentified message producers, which require that the queue be supplied every time a message is sent.
send in interface QueueSenderqueue - the queue to send this message tomessage - the message to senddeliveryMode - the delivery mode to usepriority - the priority for this messagetimeToLive - the message's lifetime (in milliseconds)JMSException - if the JMS provider fails to send the message
due to some internal error.MessageFormatException - if an invalid message is specified.InvalidDestinationException - if a client uses
this method with an invalid queue.public Queue getQueue() throws JMSException
QueueSenderQueueSender.getQueue in interface QueueSenderJMSException - if the JMS provider fails to get the queue for
this QueueSender
due to some internal error.Copyright © 2012 JBoss by Red Hat. All Rights Reserved.