com.softwareag.entirex.jms
Class TextFormatterReplyQueue

java.lang.Object
  extended by com.softwareag.entirex.jms.TextFormatterReplyQueue
All Implemented Interfaces:
JMSFormatter

public class TextFormatterReplyQueue
extends java.lang.Object
implements JMSFormatter

Standard implementation for a formatter class for the EntireX JMS layer. Used to format JMS messages in a standard text message format. The text of a TextMessage is send as the payload of an ACI message contained in a unit of work. The ReplyTo destination is included in this ACI message. The type of the ReplyTo destination is coded in a single character: '1' for queue (use 'JMS/<queue name>/QUEUE' as service), '2' for temporary queue (use 'JMS/<queue name>/TMPQUEUE' as service), '3' for topic (use '<topic name>' as topic), '4' for temporary topic (use '<topic name>' as topic).


Constructor Summary
TextFormatterReplyQueue()
           
 
Method Summary
 byte[] fromJMSMessage(javax.jms.Session session, javax.jms.Message message)
          Formats a byte array from a JMS Message.
 javax.jms.Message toJMSMessage(javax.jms.Session session, byte[] buffer)
          Create a JMS message from the byte array received from the broker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFormatterReplyQueue

public TextFormatterReplyQueue()
Method Detail

toJMSMessage

public javax.jms.Message toJMSMessage(javax.jms.Session session,
                                      byte[] buffer)
                               throws javax.jms.JMSException
Create a JMS message from the byte array received from the broker.

Specified by:
toJMSMessage in interface JMSFormatter
Parameters:
session - the JMS session, used to create the JMS message.
buffer - the message from the broker.
Returns:
the JMS message created from the byte array.
Throws:
javax.jms.JMSException - if the message is not properly created.

fromJMSMessage

public byte[] fromJMSMessage(javax.jms.Session session,
                             javax.jms.Message message)
                      throws javax.jms.JMSException
Formats a byte array from a JMS Message. This method assumes the message is a TextMessage. The ReplyTo destination is coded in the first 32 characters of the message. Position 33 is the type of the ReplyTo destination. The byte array is build with the default encoding from the String.

Specified by:
fromJMSMessage in interface JMSFormatter
Parameters:
session - the JMS session (currently not used).
message - the JMS message to format. A TextMessage is needed.
Returns:
the message formatted as a byte array.
Throws:
javax.jms.JMSException - if the message is not properly created.