John D'Emic's blog about programming, integration, system administration, etc...

Thursday, September 24, 2009

HornetQ and Mule

The lack of OpenMQ's delivery retry options have led me down the road of evaluating JMS brokers again. I luckily didn't have to look very far. JBoss' recently released HornetQ broker is very impressive. Getting it going with Mule is trivial. Here's the config I'm using, which connects to a local HornetQ instance using Netty (instead of JNDI.)


<spring:bean name="transportConfiguration"
class="org.hornetq.core.config.TransportConfiguration">
<spring:constructor-arg
value="org.hornetq.integration.transports.netty.NettyConnectorFactory"/>
</spring:bean>

<spring:bean name="connectionFactory"
class="org.hornetq.jms.client.HornetQConnectionFactory">
<spring:constructor-arg ref="transportConfiguration"/>
<spring:property name="minLargeMessageSize" value="250000"/>
<spring:property name="cacheLargeMessagesClient" value="false"/>
</spring:bean>

<jms:connector name="jmsConnector"
connectionFactory-ref="connectionFactory"
createMultipleTransactedReceivers="false"
numberOfConcurrentTransactedReceivers="1"
specification="1.1">
</jms:connector>

11 comments:

aperepel said...

Hi John,

The scope of 'local' wasn't quite clear. Did you mean the in-process embedded HornetQ broker? Just a note, for external standalone HornetQ the config is exactly the same as before for JBoss JMS/MQ, no changes.

johndemic said...

Hey Andrew,

My apologies. By "local" I meant HornetQ running non-clustered and standalone (outside of JBoss AS) on localhost. Tangentially, getting it going embedded is fairly straightforward as well. I'll try to post the config later on.

Mi nombre said...

as far as I know, openMQ does have retry options .. what's exactly what you found lacking?

aperepel said...

Take a look at http://www.mulesoft.org/jira/browse/MULE-4166?focusedCommentId=28896&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_28896

johndemic said...

The fact that you can't specify a delay between retries is what I found lacking.

Luke said...

Hello, please note that in the 2.0.0GA version the transportConfiguration bean class should be "org.hornetq.api.core.TransportConfiguration" rather than "org.hornetq.core.config.TransportConfiguration" otherwise you'll get a ClassNotFound Exception

Ken Young said...

Thanks for the head start on HornetQ and Spring. Any chance you have an example of configuring HornetQ's Queues or Topics via spring beans as well?

Also, are you skipping exporting HornetQ via JNDI in this case?

Again, thanks for the head start.

nick said...

Hi John,

Im try'n around with your example, but I got an exception on the hornetq server when connteting.

Which version of mule and which version of hornetQ did you used in this example.

nick said...

Hi John,

im try'n around with your example, but i got an exception when connecting to the hornetQ server thrown by the Message - Server.

Which Version of mule and with version of hornetQ did you used in your scenario.

Greets

johndemic said...

I used one of the 2.0.0 betas, I don't recall exactly which one. Try using the following configuration, however, it works for me with 2.1.0-Final:


http://pastebin.com/fytpm3Yp

nick said...

Hi John,

fisr of all big thanks. I think this was an compatibilty problem. I used 2.1 Final now go back to 2.0 GA.

And volai it works ;) .

I only changed my dependencies in pom and used 2.0GA HQ standalone server.

Greets