|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.tools.util.DirectCallMessager
org.sandev.tools.util.JMSMessager
A Messager implementation for use over JMS. This is tested using OpenJMS. Extends DirectCallMessager to provide optimized messaging for nodes on the same server.
| Field Summary | |
protected org.sandev.basics.nodecommon.CharSerializer |
charSerializer
The CharSerializer we use for converting objects to text and back. |
protected javax.jms.TopicConnection |
connection
Single connection to the provider is all we need |
protected javax.naming.Context |
context
|
protected javax.jms.TopicSession |
session
Use a single TopicSession since we're not using transactions |
protected java.util.Hashtable |
subscriberMap
Map of topic name to TopicSubscribers |
| Fields inherited from class org.sandev.tools.util.DirectCallMessager |
ourInstance, ourNode, subTable |
| Fields inherited from interface org.sandev.basics.nodecommon.Messager |
MODE_DIRECT, MODE_INVALID, MODE_SECURE, OPTIMIZE_IF_POSSIBLE, OPTIMIZE_NEVER, WIRE_BASICSECURITY, WIRE_SECURECOMMS, WIRE_TRANSPORTONLY |
| Constructor Summary | |
JMSMessager()
Default ctor does nothing. |
|
| Method Summary | |
protected javax.jms.TopicSession |
createSession()
Create a JMS TopicSession. |
protected javax.jms.TopicConnection |
createTopicConnection()
Create and start a JMS TopicConnection. |
protected org.sandev.basics.structs.SandMessage |
deserializeJMSMessage(javax.jms.TextMessage message)
Deserialize a SandMessage serialized as a JMS TextMessage. |
protected void |
doDeliver(javax.jms.Message message)
Deserialize a JMS message and pass it to the node's deliver method. |
protected org.sandev.basics.structs.SandMessage |
doQuery(org.sandev.basics.structs.SandMessage msg,
java.lang.String topicName)
Perform a synchronous query on the given Topic. |
protected org.sandev.basics.structs.SandMessage |
doQuery(org.sandev.basics.structs.SandMessage msg,
java.lang.String recipient,
int optimize)
Query the specified node. |
protected void |
doReceive(javax.jms.Message message)
Deserialize a JMS message, pass it to the node's receive method, and return the response to the Topic specified in the JMS message's replyTo field. |
protected void |
doSend(org.sandev.basics.structs.SandMessage msg,
int optimize)
Send the message. |
protected void |
doSend(org.sandev.basics.structs.SandMessage msg,
java.lang.String topicName)
Send a SandMessage to the specified JMS topic. |
protected void |
doSubscribe(org.sandev.basics.nodecommon.Messageable node,
java.lang.String msgClass,
java.lang.String sender,
int optimize)
Make the subscription happen. |
protected void |
doUnsubscribe(org.sandev.basics.nodecommon.Messageable node,
java.lang.String msgClass,
java.lang.String sender,
int optimize)
Make the subscription go away. |
org.sandev.basics.nodecommon.CharSerializer |
getCharSerializer()
accessor for charSerializer |
protected javax.naming.Context |
getContext()
Create a JNDI Context for JMS Topic lookups. |
protected int |
getImplementationWireSecurity()
JMS doesn't specify wire-level security (although some providers support secure transports like SSL). |
protected javax.jms.Topic |
getTopic(java.lang.String topic)
Lookup the JMS Topic with the given topic name. |
void |
init(org.sandev.basics.nodecommon.Messageable node,
org.sandev.basics.structs.NodeInstance instance)
|
protected void |
jmsSubscribe(java.lang.String topicName)
Subscribe this messager to a JMS topic. |
protected void |
jmsUnsubscribe(java.lang.String topicName)
Unsubscribe this messager from a JMS topic. |
void |
onMessage(javax.jms.Message message)
Receive a JMS Message, unpack it, and pass it to the node. |
protected java.lang.String |
serializeSandMessage(org.sandev.basics.structs.SandMessage sandMessage)
Serialize a SandMessage as a text string for inclusion in a JMS TextMessage. |
void |
setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
mutator for charSerializer |
void |
shutdown()
|
| Methods inherited from class org.sandev.tools.util.DirectCallMessager |
addSubscriber, doSend, error, getMessageable, getOurInstance, getOurNode, getSubTable, getWireSecurity, info, query, queryReceiver, removeSubscriber, send, setOurInstance, setOurNode, subscribe, unsubscribe |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected javax.naming.Context context
protected javax.jms.TopicConnection connection
protected javax.jms.TopicSession session
protected java.util.Hashtable subscriberMap
protected org.sandev.basics.nodecommon.CharSerializer charSerializer
| Constructor Detail |
public JMSMessager()
| Method Detail |
public org.sandev.basics.nodecommon.CharSerializer getCharSerializer()
public void setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
public void init(org.sandev.basics.nodecommon.Messageable node,
org.sandev.basics.structs.NodeInstance instance)
throws org.sandev.basics.nodecommon.MessagerException
init in interface org.sandev.basics.nodecommon.Messagerinit in class DirectCallMessagerorg.sandev.basics.nodecommon.MessagerExceptionpublic void shutdown()
shutdown in interface org.sandev.basics.nodecommon.Messagershutdown in class DirectCallMessagerpublic void onMessage(javax.jms.Message message)
onMessage in interface javax.jms.MessageListenerprotected int getImplementationWireSecurity()
getImplementationWireSecurity in class DirectCallMessager
protected void doSubscribe(org.sandev.basics.nodecommon.Messageable node,
java.lang.String msgClass,
java.lang.String sender,
int optimize)
throws org.sandev.basics.nodecommon.MessagerException
doSubscribe in class DirectCallMessagerorg.sandev.basics.nodecommon.MessagerException
protected void doUnsubscribe(org.sandev.basics.nodecommon.Messageable node,
java.lang.String msgClass,
java.lang.String sender,
int optimize)
throws org.sandev.basics.nodecommon.MessagerException
doUnsubscribe in class DirectCallMessagerorg.sandev.basics.nodecommon.MessagerException
protected void doSend(org.sandev.basics.structs.SandMessage msg,
int optimize)
throws org.sandev.basics.nodecommon.MessagerException
doSend in class DirectCallMessagerorg.sandev.basics.nodecommon.MessagerException
protected void doSend(org.sandev.basics.structs.SandMessage msg,
java.lang.String topicName)
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected org.sandev.basics.structs.SandMessage doQuery(org.sandev.basics.structs.SandMessage msg,
java.lang.String recipient,
int optimize)
throws org.sandev.basics.nodecommon.MessagerException
doQuery in class DirectCallMessagerorg.sandev.basics.nodecommon.MessagerException
protected org.sandev.basics.structs.SandMessage doQuery(org.sandev.basics.structs.SandMessage msg,
java.lang.String topicName)
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected void doReceive(javax.jms.Message message)
throws javax.jms.JMSException,
java.io.IOException,
org.sandev.basics.structs.SandException
replyTo field.
javax.jms.JMSException
java.io.IOException
org.sandev.basics.structs.SandException
protected void doDeliver(javax.jms.Message message)
throws javax.jms.JMSException,
java.io.IOException,
org.sandev.basics.structs.SandException
javax.jms.JMSException
java.io.IOException
org.sandev.basics.structs.SandException
protected javax.naming.Context getContext()
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected javax.jms.TopicConnection createTopicConnection()
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected javax.jms.TopicSession createSession()
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected javax.jms.Topic getTopic(java.lang.String topic)
throws javax.naming.NamingException
javax.naming.NamingException
protected void jmsSubscribe(java.lang.String topicName)
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected void jmsUnsubscribe(java.lang.String topicName)
throws org.sandev.basics.nodecommon.MessagerException
org.sandev.basics.nodecommon.MessagerException
protected java.lang.String serializeSandMessage(org.sandev.basics.structs.SandMessage sandMessage)
throws java.io.IOException
java.io.IOException
protected org.sandev.basics.structs.SandMessage deserializeJMSMessage(javax.jms.TextMessage message)
throws javax.jms.JMSException,
java.io.IOException
javax.jms.JMSException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||