New to ESB, question on configuration
jcadam14 Oct 31, 2011 7:58 PMHello there, I've just started working with JBoss ESB 4.7. For our purposes, it's going to act as a message router, passing JMS Text Messages around depending on data within the message. The goal is to have the ESB put hooks into different servers running and listen for messages on give topics/queues.
For testing purposes, I want to configure the ESB to listen to a queue in an external JBoss 6 server, and when a message arrives there it sends it to a queue on an external ActiveMQ server. So very basic. I have a two test classes, one that sends the message and one that listens and prints the message out.
My jboss-esb.xml looks like the following:
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
<providers>
<jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
jndi-URL="jnp://externaljbosshose:1099"
jndi-context-factory="org.jnp.interfaces.NamingContextFactory">
<jms-bus busid="testIn">
<jms-message-filter
dest-type="QUEUE"
dest-name="/queue/testInQueue"/>
</jms-bus>
</jms-provider>
</providers>
<services>
<service
category="JMSSecuredESB"
name="SimpleListener"
description="Text Message Router">
<listeners>
<jms-listener name="JMS-Gateway" busidref="testIn" is-gateway="false" >
</jms-listener>
</listeners>
<actions mep="OneWay">
<action name="routeToReplyQueue" class="org.jboss.soa.esb.actions.routing.JMSRouter">
<property name="jndi-context-factory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<property name="jndi-URL" value="tcp://externalactivemqhost:61616"/>
<property name="jndi-pkg-prefix" value="org.apache.activemq.jndi"/>
<property name="connection-factory" value="ConnectionFactory"/>
<property name="jndiName"
value="testOutQueue"/>
<property name="unwrap" value="true"/>
<property name="security-principal" value="guest"/>
<property name="security-credential" value="guest"/>
</action>
</actions>
</service>
</services>
</jbossesb>
If I use this configuration, I get the following message:
14:22:05,349 ERROR [JmsComposer] Unsupported JMS message type: org.hornetq.jms.client.HornetQTextMessage for incoming ESB-aware message.
If I change is-gateway to true, the ESB server throws an exception saying:
Caused by: org.jboss.soa.esb.ConfigurationException: Service 'JMSSecuredESB:SimpleListener' does not define a Message-Aware (is-gateway='false') nor InVm Listener.
So I'm guessing I'm just missing some other configuration to tell the ESB that it's just passing a JMS message along, but I'm not sure where to look. I've gone through a lot of the sample configurations but none of them seem to address this particular case of not holding the queues itself, but instead just routing from one external queue to another (or if there is that example, it's lost on me, which is very possible).
Any help in pointing me to a source or configuration to get this working would be tremendously helpful.
Thanks in advance
Jason
EDIT: Ok, so after doing some more reading, the issue was I was using TextMessage objects instead of ObjectMessage. So I changed that, but after doing so cause a whole new error (but at least I'm advancing in some direction). For the object that I set in the ObjectMessage, I just put a simple String saying "Test".
The error is below:
16:41:50,260 ERROR [JmsComposer] Object in JMS message is not a Serializeable
java.io.IOException: Util.deserialize caught XMLStreamException
at org.jboss.soa.esb.util.Util.deserialize(Util.java:225)
at org.jboss.internal.soa.esb.couriers.helpers.JmsComposer.compose(JmsCo
mposer.java:72)
at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java
:460)
at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCo
urierImpl.java:228)
at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCo
urierImpl.java:204)
at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEvent
AndProcess(MessageAwareListener.java:297)
at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(Messag
eAwareListener.java:253)
at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycl
e.run(AbstractThreadedManagedLifecycle.java:115)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'T
' (code 84) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:
623)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.ja
va:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095
)
at org.jboss.internal.soa.esb.util.stax.StreamHelper.skipToNextStartElem
ent(StreamHelper.java:293)
at org.jboss.internal.soa.esb.util.stax.StreamHelper.checkNextStartTag(S
treamHelper.java:335)
at org.jboss.soa.esb.util.Util.deserialize(Util.java:218)
... 8 more
I found some sources online that talked about needing to upgrade to some other version of SOAP but I'm not sure that is valid here. Has anyone else experienced this?
Thanks
Jason
FINAL EDIT: Woohoo, success! So apparently I just needed to add a native inVm queue and listener, and now TextMessage objects work wonderfully. I'm assuming the inVm listener is used as a sort of bridge between the two external messaging systems. Sort of like an intermediary endpoint that the gateway then acts upon and then sends it to the final endpoint (hopefully I understand that correctly). But yay, it works.