Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to use smartclient to publish and subcribe message from ActiveMQ's message queue?

    How to use smartclient to publish and subcribe message from ActiveMQ's message queue?

    thanks....

    #2
    is anyone can help me???????

    Comment


      #3
      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/...g_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.

      Comment


        #4
        oh,i c.
        thanks Isomorphic.

        Comment


          #5
          Hi,Isomorphic.
          what does this config message from server.properties use to?
          messaging.jms.context: _container_
          messaging.jms.jndiPrefix: jms
          messaging.jms.topicConnectionFactory: TopicConnectionFactory

          Comment


            #6
            Code:
            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.

            Code:
            messaging.jms.jndiPrefix: jms
            This is an optional prefix to the location from which we will look up the topicConnectionFactory.

            Code:
            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:

            Code:
            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?

            Comment


              #7
              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.

              Comment


                #8
                Follow these steps:

                1. Download, install, and start ActiveMQ following instructions here: http://activemq.apache.org/getting-started.html.
                2. Copy the ActiveMQ jar (e.g. apache-activemq-4.1.1.jar) into your WEB-INF/lib directory.
                3. Create a file called jndi.properties in your WEB-INF/classes directory with the following contents:

                Code:
                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.

                4. If you have a server.properties file in WEB-INF/classes, edit it, otherwise create it and add the following to it:

                Code:
                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.

                5. Restart your application server.

                The simple messaging example should now work through this JMS configuration without any changes.

                Comment

                Working...
                X