Java JMS Messaging

Posted by London on Stack Overflow See other posts from Stack Overflow or by London
Published on 2010-06-01T08:10:21Z Indexed on 2010/06/01 8:13 UTC
Read the original article Hit count: 490

Filed under:
|
|
|
|

Hello, I have a working example of sending message to server and server receiving it via qpid messaging. Here is simple hello world to send to server :

http://pastebin.com/M7mSECJn

And here is server which receives requests and sends response(the current client doesn't receive response) :

http://pastebin.com/2mEeuzrV

Here is my property file :

http://pastebin.com/TLEFdpXG

They all work perfectly, I can see the messages in the qpid queue via Qpid JMX management console. These examples are downloaded from https://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/example (someone may need it also).

I've done Jboss messaging using spring before, but I can't manage to do the same with qpid. With jboss inside applicationsContext I had beans jndiTemplate, conectionFactory, destinationQueue, and jmscontainer like this :

<!-- Queue configuration -->
 <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
  <property name="environment">
   <props>
    <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
    <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
    <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
    <prop key="java.naming.security.principal">admin</prop>
    <prop key="java.naming.security.credentials">admin</prop>
   </props>
  </property>
 </bean>

 <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiTemplate" ref="jndiTemplate" />
  <property name="jndiName" value="ConnectionFactory" />
 </bean>

 <bean id="queueDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
  <property name="jndiTemplate" ref="jndiTemplate" />
  <property name="jndiName">
   <value>queue/testQueue</value>
  </property>
 </bean>

  <bean id="jmsContainer"
  class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  <property name="connectionFactory" ref="connectionFactory" />
  <property name="destination" ref="queueDestination" />
  <property name="messageListener" ref="listener" />
 </bean>

and of course sender and listener :

Now I'd like to rewrite this qpid example using spring context logic. Can anyone help me?

© Stack Overflow or respective owner

Related posts about java

Related posts about spring