|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface provides an access to JMS objects needed by JMS transport.
Implementations should access the objects in provider-specific way.
It's responsible for receiving and sending JMS messages on both server
and client sides.
It's on the responsibility of the reduction to add support for coupling of JMS messages.
It's common to use JMS string property with name JmsConstants.MSG_CALL_ID to
transfer the coupling information. Only messages sent over JMS queues can couple and can
simulate the synchronous transport.
The methods responsible to send or publish messages (sendClientData and publishClientData)
on the client side should transform all properties got as jmsProperties to the properties of
the JMS message.
Moreover, they must set the string property with the name JmsConstants.MSG_TYPE to value
JmsConstants.TYPE_REQUEST, set the JMS int property JmsConstants.CALL_METHOD according
to the property with the same name and sendClientData should set the string property with the name
JmsConstants.MSG_CALLID or JMS correlation ID to value, which is unique for the optional
request - response pair. It should also take JmsConstanst.SERVER_SELECTOR value from the
jmsProperties and store it to use for selection in the optional call of the method method
receiveData.
On the server side, the listening methods startQueueListening and startTopicListening should
listen using the selector, which selects messages where JmsConstants.MSG_TYPE propety equals
to JmsConstants.TYPE_REQUEST and if server selector is set, JmsConstants.SERVER_SELECTOR equals
to the value of their serverSelector parameter. When a meesage is received, these methods should
also create output properties, where they store the state information like call id of the received message.
The output properties must also contain property with the name JmsConstants.CALL_METHOD and
Integer value set according to the JMS property with the same name. Optionaly it should try to get JMS property
and set the property in the properties map with names :
JmsConstants
,
JmsDataHandler
Method Summary | |
boolean |
check()
Determines, whether this reduction can be used. |
void |
publishClientData(javax.jms.TopicSession session,
javax.jms.Topic topic,
byte[] data,
java.util.Map jmsProperties,
int deliveryMode,
int priority,
int timeToLive)
This method publishes data using the topic session and the topic. |
byte[] |
receiveClientData(javax.jms.QueueSession session,
javax.jms.Queue queue,
long timeout,
java.util.Map properties)
Receives data using the queue and session. |
javax.jms.Queue |
resolveQueue(java.lang.String name)
Resolves the queue with the given name |
javax.jms.QueueConnectionFactory |
resolveQueueConnectionFactory(java.lang.String name)
Resolves the queue connection factory with the given name |
javax.jms.Topic |
resolveTopic(java.lang.String name)
Resolves the topic with the given name |
javax.jms.TopicConnectionFactory |
resolveTopicConnectionFactory(java.lang.String name)
Resolves the topic connection factory with the given name |
void |
sendClientData(javax.jms.QueueSession session,
javax.jms.Queue queue,
javax.jms.Queue replyQueue,
byte[] data,
java.util.Map jmsProperties,
int deliveryMode,
int priority,
int timeToLive)
Sends data using the queue and session. |
void |
sendData(javax.jms.QueueSession session,
javax.jms.Queue queue,
byte[] data,
java.util.Map outputProperties,
int deliveryMode,
int priority,
int timeToLive)
Sends an output message on the server side. |
void |
startQueueListening(JmsDataHandler handler,
javax.jms.QueueSession session,
javax.jms.Queue queue,
java.lang.String serverSelector)
Typicaly, this method calls server side part of the JMS transport when it starts listening. |
void |
startResolving(java.util.Map properties)
Called when the first resolve* method is going to be called after the reduction was instantiated or the method stopResolving was closed. |
void |
startTopicListening(JmsDataHandler handler,
javax.jms.TopicSession session,
javax.jms.Topic topic,
java.lang.String serverSelector,
java.lang.String durableId)
Typicaly, this method calls server side part of the JMS transport when it starts listening. |
void |
stopListening()
Stops listening and frees resources allocated for this server side reduction |
void |
stopResolving()
Called after the last resolve* method call. |
Method Detail |
public void startResolving(java.util.Map properties) throws javax.naming.NamingException
properties
- allows passing of customization parameters to
the reduction implementation. User may pass them using
WebserviceLookup.lookup(...). Otherwise, the properties
are read from JMS transport configuration.
javax.naming.NamingException
public void stopResolving() throws javax.naming.NamingException
javax.naming.NamingException
public boolean check()
public javax.jms.Queue resolveQueue(java.lang.String name) throws javax.naming.NamingException
name
- of the queue
javax.naming.NamingException
public javax.jms.Topic resolveTopic(java.lang.String name) throws javax.naming.NamingException
name
- of the topic
javax.naming.NamingException
public javax.jms.QueueConnectionFactory resolveQueueConnectionFactory(java.lang.String name) throws javax.naming.NamingException
name
- of the queue connection factory
javax.naming.NamingException
public javax.jms.TopicConnectionFactory resolveTopicConnectionFactory(java.lang.String name) throws javax.naming.NamingException
name
- of the topic connection factory
javax.naming.NamingException
public void sendClientData(javax.jms.QueueSession session, javax.jms.Queue queue, javax.jms.Queue replyQueue, byte[] data, java.util.Map jmsProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
String serverSelector = (String)jmsProperties.get(JmsConstants.SERVER_SELECTOR)
session
- the session to be used when sending the messagequeue
- the queue to be used when sending the messagereplyQueue
- the queue where this reduction should expect optional response data.
May be null.data
- data to be sent. The method may perform aditional processing like encrypting
or encoding the data.jmsProperties
- the JMS properties to be set ob the output message. The method may perform
aditional processing on othe properies.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
public byte[] receiveClientData(javax.jms.QueueSession session, javax.jms.Queue queue, long timeout, java.util.Map properties) throws javax.jms.JMSException
String selector = JmsConstants.MSG_TYPE + "='"
+ JmsConstants.TYPE_REQUEST + "'"
+ ( ( serverSelector == null ) ? "" : ( " AND "
+ JmsConstants.SERVER_SELECTOR + "='" + serverSelector + "'" ) );
The selector value can be obtained from the properties parameter this way :
String serverSelector = (String)outputProperties.get(JmsConstants.SERVER_SELECTOR)
session
- the session to be used when receiving the messagequeue
- the queue to be used when receiving the messagetimeout
- time, after timeout occuresproperties
- the structure to be filled with received properties and it initialy contains
some properties like server selector value used to receive message
javax.jms.JMSException
public void publishClientData(javax.jms.TopicSession session, javax.jms.Topic topic, byte[] data, java.util.Map jmsProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
String serverSelector = (String)jmsProperties.get(JmsConstants.SERVER_SELECTOR)
session
- the session to be used when publishing the messagetopic
- the topic to be used when publishing the messagedata
- data to be sent. The method may perform aditional processing like encrypting
or encoding the data.jmsProperties
- the JMS properties to be set ob the output message. The method may perform
aditional processing on othe properies.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
public void startQueueListening(JmsDataHandler handler, javax.jms.QueueSession session, javax.jms.Queue queue, java.lang.String serverSelector) throws javax.jms.JMSException
JmsDataHandler.processData(byte[],Map,Map,Reduction,javax.jms.Destination)
handler
- the handler to be used to process received datasession
- the session which receives the dataqueue
- the queue which receives the dataserverSelector
- id which identifies messages sent to the server. If not null,
the listening must be performed with the selector string :
String selector = JmsConstants.MSG_TYPE + "='"
+ JmsConstants.TYPE_REQUEST + "'"
+ ( ( serverSelector == null ) ? "" : ( " AND "
+ JmsConstants.SERVER_SELECTOR + "='" + serverSelector + "'" ) );
javax.jms.JMSException
public void startTopicListening(JmsDataHandler handler, javax.jms.TopicSession session, javax.jms.Topic topic, java.lang.String serverSelector, java.lang.String durableId) throws javax.jms.JMSException
handler
- the handler to be used to process received datasession
- the session which receives the datatopic
- the topic which receives the dataserverSelector
- id which identifies messages sent to the server. If not null,
the listening must be performed with the selector string :
String selector = JmsConstants.MSG_TYPE + "='"
+ JmsConstants.TYPE_REQUEST + "'"
+ ( ( serverSelector == null ) ? "" : ( " AND "
+ JmsConstants.SERVER_SELECTOR + "='" + serverSelector + "'" ) );
durableId
- the client identifier of the durable subscription. If null, the subscriber
will not be durable.
javax.jms.JMSException
public void stopListening()
public void sendData(javax.jms.QueueSession session, javax.jms.Queue queue, byte[] data, java.util.Map outputProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
String serverSelector = (String)outputProperties.get(JmsConstants.SERVER_SELECTOR)
session
- the session, which sends dataqueue
- the queue, which sends datadata
- the data to be sentoutputProperties
- JMS properties which have to be set on the output JMS message.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |