How to use smartclient to publish and subcribe message from ActiveMQ’s message queue?
thanks…
How to use smartclient to publish and subcribe message from ActiveMQ’s message queue?
thanks…
is anyone can help me???
The SmartClient Realtime Messaging module can connect to any JMS provider. Take a look at the Messaging QuickRef here:
http://www.smartclient.com/docs/5.6/docs/resources/Messaging_QuickRef.pdf
Once you’ve configured the SmartClient server to use the JMSMessageDispatcher, the channels that you subscribe() to on the client map directly to topics in JMS.
oh,i c.
thanks Isomorphic.
Hi,Isomorphic.
what does this config message from server.properties use to?
messaging.jms.context: container
messaging.jms.jndiPrefix: jms
messaging.jms.topicConnectionFactory: TopicConnectionFactory
messaging.jms.context: _container_
The above means we use the standard container prefix “java:comp/env” to obtain the initial JNDI Context. This is what you want if you’re configuring JMS via your J2EE container. If your JMS queues will not be provided by the container, then leave this blank.
messaging.jms.jndiPrefix: jms
This is an optional prefix to the location from which we will look up the topicConnectionFactory.
messaging.jms.topicConnectionFactory: TopicConnectionFactory
This is the name of the topicConnectionFactory as it’s provided via JNDI. So the default configuration (listed above) would result in the following code being executed:
Context ctx = new InitialContext(new Hashtable());
ctx = (Context)ctx.lookup("java:comp/env");
ctx = (Context)ctx.lookup("jms");
// this is actually looked up from config, but listing it explicitly here
String topicConnectionFactoryName = "TopicConnectionFactory";
TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory)ctx.lookup(topicConnectionFactoryName);
Makes sense?
Hi Isomorphic, I’m also very interested in this topic. My boss has asked me to do some evaluation on SmartClient. I need to show him how to use ActiveMQ in the simple chat sample, which comes with the SmartClient SDK.
Would you please kindly provide a sample, that is based on the simple chat sample, to show us how to port it from in-memory messaging delivery system to JMS?
Thanks in advance.
Follow these steps:
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
# use the following property to configure the default connector
java.naming.provider.url = tcp://localhost:61616
# use the following property to specify the JNDI name the connection factory
# should appear as.
connectionFactoryNames = TopicConnectionFactory
# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.chatChannel = chatChannel
Note that if your JMS server is at a different TCP endpoint, be sure to put in the correct hostname/port combination above.
messaging.dispatcherImplementer: com.isomorphic.messaging.JMSMessageDispatcher
# jms configuration - only relevant for JMSMessageDispatcher, not used by LocalMessageDispatcher
jndi.messaging.java.naming.factory.initial: org.apache.activemq.jndi.ActiveMQInitialContextFactory
jndi.messaging.java.naming.provider.url: tcp://localhost:61616
messaging.jms.context: messaging
messaging.jms.jndiPrefix:
messaging.jms.topicConnectionFactory: TopicConnectionFactory
Note that if your JMS server is at a different TCP endpoint, be sure to put in the correct hostname/port combination above.
The simple messaging example should now work through this JMS configuration without any changes.