com.caucho.jms.connection
Class MessageProducerImpl

java.lang.Object
  extended by com.caucho.jms.connection.MessageProducerImpl
All Implemented Interfaces:
MessageProducer
Direct Known Subclasses:
QueueSenderImpl, TopicPublisherImpl

public class MessageProducerImpl
extends java.lang.Object
implements MessageProducer

A basic message producer.


Field Summary
protected  AbstractDestination _queue
           
protected  JmsSession _session
           
static long DEFAULT_TIME_TO_LIVE
           
 
Constructor Summary
MessageProducerImpl(JmsSession session, AbstractDestination queue)
           
 
Method Summary
protected  long calculateExpiration(long timeToLive)
          Calculates the expires time.
 void close()
          Closes the producer.
 int getDeliveryMode()
          Returns the default delivery mode.
 Destination getDestination()
          Returns the producer's destination.
 boolean getDisableMessageID()
          Returns true if message ids are disabled by default.
 boolean getDisableMessageTimestamp()
          Returns true if message timestamps are disabled by default.
 int getPriority()
          Returns the default priority
 long getTimeToLive()
          Returns the default time to live
 void send(Destination destination, Message message)
          Sends a message to the destination
 void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
          Sends a message to the destination
 void send(Message message)
          Sends a message to the destination
 void send(Message message, int deliveryMode, int priority, long timeToLive)
          Sends a message to the destination
 void setDeliveryMode(int deliveryMode)
          Sets the default delivery mode.
 void setDisableMessageID(boolean disable)
          Sets true if message ids should be disabled by default.
 void setDisableMessageTimestamp(boolean disable)
          Sets true if message timestamps should be disabled by default.
 void setPriority(int priority)
          Sets the default priority.
 void setTimeToLive(long timeToLive)
          Sets the default time to live.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TIME_TO_LIVE

public static final long DEFAULT_TIME_TO_LIVE
See Also:
Constant Field Values

_session

protected JmsSession _session

_queue

protected AbstractDestination _queue
Constructor Detail

MessageProducerImpl

public MessageProducerImpl(JmsSession session,
                           AbstractDestination queue)
Method Detail

getDestination

public Destination getDestination()
                           throws JMSException
Returns the producer's destination.

Specified by:
getDestination in interface MessageProducer
Throws:
JMSException

getDeliveryMode

public int getDeliveryMode()
                    throws JMSException
Returns the default delivery mode.

Specified by:
getDeliveryMode in interface MessageProducer
Throws:
JMSException

setDeliveryMode

public void setDeliveryMode(int deliveryMode)
                     throws JMSException
Sets the default delivery mode.

Specified by:
setDeliveryMode in interface MessageProducer
Throws:
JMSException

getDisableMessageID

public boolean getDisableMessageID()
                            throws JMSException
Returns true if message ids are disabled by default.

Specified by:
getDisableMessageID in interface MessageProducer
Throws:
JMSException

setDisableMessageID

public void setDisableMessageID(boolean disable)
                         throws JMSException
Sets true if message ids should be disabled by default.

Specified by:
setDisableMessageID in interface MessageProducer
Throws:
JMSException

getDisableMessageTimestamp

public boolean getDisableMessageTimestamp()
                                   throws JMSException
Returns true if message timestamps are disabled by default.

Specified by:
getDisableMessageTimestamp in interface MessageProducer
Throws:
JMSException

setDisableMessageTimestamp

public void setDisableMessageTimestamp(boolean disable)
                                throws JMSException
Sets true if message timestamps should be disabled by default.

Specified by:
setDisableMessageTimestamp in interface MessageProducer
Throws:
JMSException

getPriority

public int getPriority()
                throws JMSException
Returns the default priority

Specified by:
getPriority in interface MessageProducer
Throws:
JMSException

setPriority

public void setPriority(int priority)
                 throws JMSException
Sets the default priority.

Specified by:
setPriority in interface MessageProducer
Throws:
JMSException

getTimeToLive

public long getTimeToLive()
                   throws JMSException
Returns the default time to live

Specified by:
getTimeToLive in interface MessageProducer
Throws:
JMSException

setTimeToLive

public void setTimeToLive(long timeToLive)
                   throws JMSException
Sets the default time to live.

Specified by:
setTimeToLive in interface MessageProducer
Throws:
JMSException

send

public void send(Message message)
          throws JMSException
Sends a message to the destination

Specified by:
send in interface MessageProducer
Parameters:
message - the message to send
Throws:
JMSException

send

public void send(Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
Sends a message to the destination

Specified by:
send in interface MessageProducer
Parameters:
message - the message to send
deliveryMode - the delivery mode
priority - the priority
timeToLive - how long the message should live
Throws:
JMSException

send

public void send(Destination destination,
                 Message message)
          throws JMSException
Sends a message to the destination

Specified by:
send in interface MessageProducer
Parameters:
destination - the destination the message should be send to
message - the message to send
Throws:
JMSException

send

public void send(Destination destination,
                 Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
Sends a message to the destination

Specified by:
send in interface MessageProducer
Parameters:
destination - the destination the message should be send to
message - the message to send
deliveryMode - the delivery mode
priority - the priority
timeToLive - how long the message should live
Throws:
JMSException

calculateExpiration

protected long calculateExpiration(long timeToLive)
Calculates the expires time.


close

public void close()
           throws JMSException
Closes the producer.

Specified by:
close in interface MessageProducer
Throws:
JMSException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object