-
1. Re: HornetQ 2.2.2.Final and Spring Framework integration.
clebert.suconic Jun 16, 2011 11:33 AM (in response to piotrekde) -
2. Re: HornetQ 2.2.2.Final and Spring Framework integration.
piotrekde Jun 16, 2011 1:13 PM (in response to clebert.suconic)Thanks Clebert,
I've read this document before and honestly I don't know how these examples can be applied to spring application using standard connection factory.
As I understand, the first listening is configuration of broker itself. In my case, broker works as an external application (actually it's whole cluster available on multicast address). The second one, defines message listener container used sometimes in Spring applications, but it doesn't fit all cases (including mine). We need standard connection factory reference to the brokers cluster.
-
3. Re: HornetQ 2.2.2.Final and Spring Framework integration.
ataylor Jun 16, 2011 1:47 PM (in response to piotrekde)We've tried using HornetQJMSClient (http://docs.jboss.org/hornetq/2.2.2.Final/api/org/hornetq/api/jms/HornetQJMSClient.html), as it has DiscoveryGroupConfiguration constructor parameter, however it causes many errors about not closed connections.
This is the way you should do it, if you are getting errors maybe we can help solve them
-
4. Re: HornetQ 2.2.2.Final and Spring Framework integration.
ataylor Jun 16, 2011 1:50 PM (in response to ataylor)If you haver a maven project that i can mess about with, i'll take a look.
-
5. Re: HornetQ 2.2.2.Final and Spring Framework integration.
piotrekde Jun 16, 2011 2:24 PM (in response to ataylor)Thank you very much! I'll try to isolate the problem into small maven project and let you know.
-
6. Re: HornetQ 2.2.2.Final and Spring Framework integration.
piotrekde Jun 17, 2011 6:08 AM (in response to ataylor)When I was isolating problem, I've worked out solution for standalone server.
Here is valid configuration for 2.2.2.Final and connection factory:
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"> <property name="targetConnectionFactory" ref="targetConnectionFactory" /> <property name="sessionCacheSize" value="100" /> <property name="cacheProducers" value="true" /> </bean> <util:constant id="QUEUE_XA_CF" static-field="org.hornetq.api.jms.JMSFactoryType.QUEUE_XA_CF" /> <bean name="targetConnectionFactory" class="org.hornetq.api.jms.HornetQJMSClient" factory-method="createConnectionFactoryWithoutHA"> <constructor-arg index="0" ref="QUEUE_XA_CF" /> <constructor-arg index="1" ref="transportConfiguration" /> </bean> <bean name="transportConfiguration" class="org.hornetq.api.core.TransportConfiguration"> <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" /> <constructor-arg> <map key-type="java.lang.String" value-type="java.lang.Object"> <entry key="host" value="localhost" /> <entry key="port" value="5445" /> </map> </constructor-arg> </bean>
Artifacts and their versions are following:
<dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-core-client</artifactId> <version>${hornetq.version}</version> </dependency> <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-jms-client</artifactId> <version>${hornetq.version}</version> </dependency> <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-spring-integration</artifactId> <version>${hornetq.version}</version> </dependency> <dependency> <groupId>org.jboss.netty</groupId> <artifactId>netty</artifactId> <version>3.2.4.Final</version> </dependency>
I attached maven project using 2.2.2.Final and spring integration.
It's extended producer-consumer example - producer sends message, which is received by consumer, transformed and sent back.
HornetQ must define following queue:
<queue name="hornetq.demo.producer.queue"> <entry name="/queue/HornetQDemoProducerQueue"/> </queue>
Now, I'll try with cluster mode and let you know.
-
hornetq-spring.tar.gz 3.3 KB
-