com.atomikos.jms
Class MessageProducerSession

java.lang.Object
  extended by com.atomikos.jms.MessageProducerSession
Direct Known Subclasses:
QueueSenderSession, TopicPublisherSession

public abstract class MessageProducerSession
extends Object

Common logic for the message producer session.


Constructor Summary
protected MessageProducerSession()
           
 
Method Summary
 javax.jms.BytesMessage createBytesMessage()
          Create a bytes message.
 javax.jms.MapMessage createMapMessage()
          Create a map message.
 javax.jms.ObjectMessage createObjectMessage()
          Create an object message.
 javax.jms.StreamMessage createStreamMessage()
          Create a stream message.
 javax.jms.TextMessage createTextMessage()
          Create a text message.
protected  AbstractConnectionFactoryBean getAbstractConnectionFactoryBean()
           
 int getDeliveryMode()
           
protected  javax.jms.Destination getDestination()
           
protected abstract  String getDestinationName()
           
 int getPriority()
           
 javax.jms.Destination getReplyToDestination()
          Gets the replyToDestination.
protected abstract  String getReplyToDestinationName()
           
 long getTimeToLive()
           
 String getUser()
           
 void init()
          Initializes the session for sending.
 void sendMessage(javax.jms.Message message)
          Send a message to the destination queue, in a transactional way.
protected  void setAbstractConnectionFactoryBean(AbstractConnectionFactoryBean bean)
           
 void setDeliveryMode(int i)
          Set the deliverymode for messages sent in this session (optional).
protected  void setDestination(javax.jms.Destination destination)
           
 void setPassword(String password)
          Set the password for explicit authentication (optional).
 void setPriority(int i)
          Set the priority for messages sent in this session (optional).
 void setReplyToDestination(javax.jms.Destination destination)
          If this session is used for sending request/reply messages, then this property indicates the destination where the replies are to be sent (optional).
 void setTimeToLive(long l)
          Set the time to live for messages sent in this session (optional).
 void setUser(String user)
          Set the user to use for explicit authentication (optional).
 void stop()
          Close any open resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageProducerSession

protected MessageProducerSession()
Method Detail

setAbstractConnectionFactoryBean

protected void setAbstractConnectionFactoryBean(AbstractConnectionFactoryBean bean)

getAbstractConnectionFactoryBean

protected AbstractConnectionFactoryBean getAbstractConnectionFactoryBean()

getDestination

protected javax.jms.Destination getDestination()

setDestination

protected void setDestination(javax.jms.Destination destination)

getDestinationName

protected abstract String getDestinationName()

getReplyToDestinationName

protected abstract String getReplyToDestinationName()

init

public void init()
Initializes the session for sending. Call this method first.


getUser

public String getUser()
Returns:
The user to connect with, or null if no explicit authentication is to be used.

setReplyToDestination

public void setReplyToDestination(javax.jms.Destination destination)
If this session is used for sending request/reply messages, then this property indicates the destination where the replies are to be sent (optional). The session uses this to set the JMSReplyTo header accordingly. This property can be omitted if no reply is needed.

The replyToDestination should be in the same JMS vendor domain as the send queue. To cross domains, configure a bridge for both the request and the reply channels.


getReplyToDestination

public javax.jms.Destination getReplyToDestination()
Gets the replyToDestination.

Returns:

setPassword

public void setPassword(String password)
Set the password for explicit authentication (optional). This is only required if the user has also been set.

Parameters:
password - The password.

setUser

public void setUser(String user)
Set the user to use for explicit authentication (optional). If no explicit authentication is required then this method should not be called.

Parameters:
user -

sendMessage

public void sendMessage(javax.jms.Message message)
                 throws javax.jms.JMSException
Send a message to the destination queue, in a transactional way. This method will open or reopen any connections if required, so that the client doesn't have to worry about that. Note: this method will fail if there is no transaction for the calling thread.

Parameters:
message -
Throws:
javax.jms.JMSException - On failures.

createTextMessage

public javax.jms.TextMessage createTextMessage()
                                        throws javax.jms.JMSException
Create a text message.

Returns:
Throws:
javax.jms.JMSException

createMapMessage

public javax.jms.MapMessage createMapMessage()
                                      throws javax.jms.JMSException
Create a map message.

Returns:
Throws:
javax.jms.JMSException

createObjectMessage

public javax.jms.ObjectMessage createObjectMessage()
                                            throws javax.jms.JMSException
Create an object message.

Returns:
Throws:
javax.jms.JMSException

createBytesMessage

public javax.jms.BytesMessage createBytesMessage()
                                          throws javax.jms.JMSException
Create a bytes message.

Returns:
Throws:
javax.jms.JMSException

createStreamMessage

public javax.jms.StreamMessage createStreamMessage()
                                            throws javax.jms.JMSException
Create a stream message.

Returns:
Throws:
javax.jms.JMSException

stop

public void stop()
Close any open resources. This method should be called when the client no longer needs the session.


getDeliveryMode

public int getDeliveryMode()
Returns:
The deliverymode for messages sent in this session.

getPriority

public int getPriority()
Returns:
The priority for messages sent in this session.

getTimeToLive

public long getTimeToLive()
Returns:
The timeToLive for messages sent in this session.

setDeliveryMode

public void setDeliveryMode(int i)
Set the deliverymode for messages sent in this session (optional). Defaults to persistent.

Parameters:
-

setPriority

public void setPriority(int i)
Set the priority for messages sent in this session (optional).

Parameters:
-

setTimeToLive

public void setTimeToLive(long l)
Set the time to live for messages sent in this session (optional).

Parameters:
-


Copyright © 2011. All Rights Reserved.