org.apache.wsif.util.jms
Class WSIFJMSDestination

java.lang.Object
  |
  +--org.apache.wsif.util.jms.WSIFJMSDestination
Direct Known Subclasses:
JMS2HTTPBridgeDestination

public class WSIFJMSDestination
extends java.lang.Object

A WSIFJMSDestination is a pair of queues, one that read from and the other that is written to. This class provides various methods for different flavours of reading and writing messages to those queues. This class hides the JMS interface.

Author:
Mark Whitlock

Constructor Summary
WSIFJMSDestination(WSIFJMSFinder finder)
          Public constructor.
WSIFJMSDestination(WSIFJMSFinder finder, long timeout)
          Public constructor.
WSIFJMSDestination(WSIFJMSFinder finder, java.lang.String altDestName, long timeout)
          Public constructor.
 
Method Summary
 void close()
          Close all objects.
 javax.jms.Message createMessage(int msgType)
           
static javax.jms.Message createMessage(javax.jms.Session session, int msgType)
           
 java.lang.String deep()
           
 void finalize()
          close the destination at finalize.
 java.util.HashMap getProperties()
          Gets all the JMS properties from the previous message that was received.
 java.lang.Object getProperty(java.lang.String name)
          Gets a JMS property from the previous message that was received.
 java.lang.String receive()
          Blocking receive for the wsif.syncrequest.timeout
 javax.jms.Message receive(java.lang.String id)
          Blocking receive waits for a message for the wsif.syncrequest.timeout
 javax.jms.Message receive(java.lang.String id, long timeout)
          Blocking receive waits for a message for the specified timeout
 java.lang.String receiveString(java.lang.String id)
          Blocking receive for the wsif.syncrequest.timeout
 java.lang.String receiveString(java.lang.String id, long timeout)
          Blocking receive waits for the specified timeout
 java.lang.String send(javax.jms.Message msg, java.lang.String id, boolean setReplyTo)
          Sends a message to the write queue.
 java.lang.String send(java.io.Serializable data)
          Send a message to the write queue
 java.lang.String send(java.io.Serializable data, java.lang.String id)
          Send a message to the write queue
 java.lang.String send(java.lang.String data)
          Send a message to the write queue
 java.lang.String send(java.lang.String data, java.lang.String id)
          Send a message to the write queue
 void setAsyncMode(boolean b)
          Sets if this destination is to be used for asynchronous requests.
 void setProperties(java.util.HashMap propMap)
          Sets a HashMap of JMS property value pairs.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a JMS property to a value.
 void setReplyToQueue()
          Set the replyTo queue to a temporary queue.
 void setReplyToQueue(java.lang.String replyTo)
          Set the replyTo queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WSIFJMSDestination

public WSIFJMSDestination(WSIFJMSFinder finder)
                   throws WSIFException
Public constructor.
Parameters:
finder - used to find JMS objects.

WSIFJMSDestination

public WSIFJMSDestination(WSIFJMSFinder finder,
                          long timeout)
                   throws WSIFException
Public constructor.
Parameters:
finder - used to find JMS objects.
timeout - is the maximum time to wait on a synchronous receive

WSIFJMSDestination

public WSIFJMSDestination(WSIFJMSFinder finder,
                          java.lang.String altDestName,
                          long timeout)
                   throws WSIFException
Public constructor.
Parameters:
finder - used to find JMS objects.
altdestName - is an alterative JMS provider destination name
timeout - is the maximum time to wait on a synchronous receive
Method Detail

close

public void close()
           throws WSIFException
Close all objects.

finalize

public void finalize()
              throws WSIFException
close the destination at finalize.

send

public java.lang.String send(java.lang.String data)
                      throws WSIFException
Send a message to the write queue
Parameters:
data - is the message
Returns:
the id of the message that was sent.

send

public java.lang.String send(java.lang.String data,
                             java.lang.String id)
                      throws WSIFException
Send a message to the write queue
Parameters:
data - is the message
id - is the correlation id to set on the message
Returns:
the id of the message that was sent.

send

public java.lang.String send(java.io.Serializable data)
                      throws WSIFException
Send a message to the write queue
Parameters:
data - is the message
Returns:
the id of the message that was sent.

send

public java.lang.String send(java.io.Serializable data,
                             java.lang.String id)
                      throws WSIFException
Send a message to the write queue
Parameters:
data - is the message
id - is the correlation id to set on the message
Returns:
the id of the message that was sent.

send

public java.lang.String send(javax.jms.Message msg,
                             java.lang.String id,
                             boolean setReplyTo)
                      throws WSIFException
Sends a message to the write queue.
Parameters:
message -  
id - Correlation id
setReplyTo - If true JMSReplyTo is always set. If false JMSReplyTo is only set if the ReplyTo was explicitly set as a property.

receive

public java.lang.String receive()
                         throws WSIFException
Blocking receive for the wsif.syncrequest.timeout
Returns:
the received message

receiveString

public java.lang.String receiveString(java.lang.String id)
                               throws WSIFException
Blocking receive for the wsif.syncrequest.timeout
Returns:
the received message

receiveString

public java.lang.String receiveString(java.lang.String id,
                                      long timeout)
                               throws WSIFException
Blocking receive waits for the specified timeout
Returns:
the received message

receive

public javax.jms.Message receive(java.lang.String id)
                          throws WSIFException
Blocking receive waits for a message for the wsif.syncrequest.timeout
Parameters:
id - is the correlation id that the received message must have
Returns:
the received message

receive

public javax.jms.Message receive(java.lang.String id,
                                 long timeout)
                          throws WSIFException
Blocking receive waits for a message for the specified timeout
Parameters:
id - is the correlation id that the received message must have
timeout - how long in milliseconds to wait
Returns:
the received message

setReplyToQueue

public void setReplyToQueue()
                     throws WSIFException
Set the replyTo queue to a temporary queue.

setReplyToQueue

public void setReplyToQueue(java.lang.String replyTo)
                     throws WSIFException
Set the replyTo queue.
Parameters:
replyTo - queue name.

setAsyncMode

public void setAsyncMode(boolean b)
                  throws WSIFException
Sets if this destination is to be used for asynchronous requests. If this destination is to be used for asynchronous requests then a WSIFJMSAsyncListener will be created to listen for the async responses.
Parameters:
b - true if this destination is to be used for asynchronous requests, otherwise false.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws WSIFException
Sets a JMS property to a value. This property value will be only be used for the next message that is sent, then the property will be reset.

setProperties

public void setProperties(java.util.HashMap propMap)
Sets a HashMap of JMS property value pairs. The property values will be only be used for the next message that is sent, then all the properties will be reset.

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws WSIFException
Gets a JMS property from the previous message that was received.

getProperties

public java.util.HashMap getProperties()
                                throws WSIFException
Gets all the JMS properties from the previous message that was received.

createMessage

public static javax.jms.Message createMessage(javax.jms.Session session,
                                              int msgType)
                                       throws WSIFException

createMessage

public javax.jms.Message createMessage(int msgType)
                                throws WSIFException

deep

public java.lang.String deep()


Copyright © 2002, 2002 Apache XML Project. All Rights Reserved.