[rules-users] Unable to pipeline Jms TEXT messages

Adam Sussman adam.sussman at gmail.com
Mon Mar 1 21:19:15 EST 2010


I am getting the following error:

org.apache.activemq.command.ActiveMQTextMessage cannot be cast to
javax.jms.ObjectMessage
       at org.drools.runtime.pipeline.impl.JmsUnwrapMessageObject.receive(JmsUnwrapMessageObject.java:18)
       at org.drools.runtime.pipeline.impl.BaseEmitter.emit(BaseEmitter.java:31)
       at org.drools.runtime.pipeline.impl.StatefulKnowledgeSessionPipelineImpl.insert(StatefulKnowledgeSessionPipelineImpl.java:40)
       at org.drools.runtime.pipeline.impl.JmsMessenger$JmsMessengerRunner.run(JmsMessenger.java:133)
       at java.lang.Thread.run(Thread.java:619)

When trying to build the following pipeline to take pure TEXT messages
off of a JMS queue and pass them to Smooks for transformation:

       KnowledgeRuntimeCommand insertStage =
PipelineFactory.newStatefulKnowledgeSessionInsert();

       // Smooks transform
       Smooks smooks = new
Smooks(getClass().getResourceAsStream("smooks-config.xml"));
       Transformer transformerStage =
PipelineFactory.newSmooksFromSourceTransformer(smooks, "foo");
       transformerStage.setReceiver(insertStage);

       // Object deserialization
       Action unwrapObjectStage = PipelineFactory.newJmsUnwrapMessageObject();
       unwrapObjectStage.setReceiver(transformerStage);

       // Pipeline entry stage
       Pipeline entry =
PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession);
       entry.setReceiver(unwrapObjectStage);

       // JNDI lookup for the JMS queue is here.  Its an ActiveMQ provider
       Service messenger = PipelineFactory.newJmsMessenger(entry,
props, "myqueue", null);

Now I know someone will say "just send objects through JMS", but that
won't work here.  The endpoint sending the messages is not Java and
can't build java object encodings.  In fact, the endpoint is the JMS providers'
own native own C++ library (ActiveMQ), so we are stuck with a pure
text message.

Is there any way to have other kinds of message unwrappers for a Jms pipeline?

I would be happy to roll my own, but I am pretty unclear on how to plug one in.

Any help would be appreciated.

-adam



More information about the rules-users mailing list