In JBI applications, each SU has its own classloader so I *think* if you make sure that your custom classes are available on the Camel SU's classpath and the JMS SU's classpath all will be well.
On Tue, Dec 15, 2009 at 5:50 PM, Kenneth H <phecda...@gmail.com> wrote: > > > > One last novice question. In the statement: > > > > > > from("seda:a").filter(header("foo").isEqualTo("bar")).to("seda:b"); > > > > > > Where does the "foo" comes from, I mean, where do I set it? From > Eclipse > > > I'm > > > creating a JMS Message, but the only headers availbe is these: > > > > > > > > > > > > http://publib.boulder.ibm.com/infocenter/tivihelp/v2r1/index.jsp?topic=/com.ibm.IBMDI.doc/referenceguide95.htm > > > > > > Do you know how I can use these headers/properties in a Camel choice > > > statement? Basicly, I just want to create the most simple example, > where > > > to > > > messages are send from Eclipse and goes to two different queues in a > > Camel > > > choice statement. The messages should be simple tect or objects. > > > > > > > >You should be able to access any of the JMS headers you mentioned in the > > >same way the "foo" header is referenced. So how are you sending JMS > > messages > > >from Eclipse? I'm assuming its a function of Tivoli in the link you > > >provided? > > > > I (or the writer of the document I'm reading) made af "Response" class > > called "InsuranceResponse". The response class is sent to the Camel > > Routebuilder. I would like to swith on either the classname of the object > > I'm sending or a field, e.g. "CompanyName", in the object. I create/send > > like this: > > > > ObjectMessage insuranceMessage = session.createObjectMessage(); > > InsuranceResponse response = new InsuranceResponse(); > > response.setRequestID("1"); > > response.setInsuranceCompanyName("Luxury Cars"); > > response.setPrice(100f); > > response.setResponseID(UUID.randomUUID().toString()); > > insuranceMessage.setObject(response); > > producer.send(insuranceMessage); > > > > Then I receive like this ("responseMessage" returns null all the time, > but > > I > > guess it's beacuse my Camel Routebuilder isn't wotking, so no object is > > send > > to the queue): > > > > ObjectMessage responseMessage = (ObjectMessage) consumer.receive(); > > InsuranceResponse insuranceMessageReceived = (InsuranceResponse) > > responseMessage.getObject(); > > > >>So I think you are looking at: > > >>http://soa.dzone.com/articles/pattern-based-development-with-0?page=0,3 > > Exactly. I'm hoping to use some of it as part of my master thesis. > > >>And it looks like they are using JIBX to convert between > InsuranceResponses > >>and XML. So, in the Camel route, the message is already in XML form so we > >>can use an XPath expression something like the following to switch on the > >>company name: > > Yes, I'm still with you. > > >>xpath("//ins:TravelInsuranceRequest/ins:insuranceCompanyName/text() = > >>'Luxury Cars'").namespace("ins","http://dzone.com/insurance") > > >>I haven't booted up the example myself so I don't know why you are not > >>getting any messages using the raw JMS API. Do the ServiceMix logs or > Camel > >>logs with trace enabled give you any more info on where the holdup could > be? > > I don't think the message even get to the Camel router. The error > Servicemix > throws is: > > javax.jms.JMSException: Error sending JBI exchange > at > > org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:575) > at > > org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:505) > at > > org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518) > at > > org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479) > at > > org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451) > at > > org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323) > at > > org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261) > at > > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982) > at > > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974) > at > > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876) > at java.lang.Thread.run(Thread.java:619) > Caused by: javax.jms.JMSException: Failed to build body from bytes. Reason: > java.io.IOException: terror.model.TerrorType1Request > at > > org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35) > at > > org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183) > at > kenneth.util.TerrorJMSMarshaler.populateMessage(TerrorJMSMarshaler.java:15) > at > > org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.createExchange(DefaultConsumerMarshaler.java:99) > at > > org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:544) > ... 10 more > > I looked the error up on the net and found: > > http://www.mail-archive.com/u...@geronimo.apache.org/msg10579.html > http://issues.apache.org/activemq/browse/AMQ-1588 > > It seems like there is a problem with deserializing the object I'm sending, > but I don't quite understand how to fix it. The two answers above talks > about moving some classes? Any ideas to solve it? > > > -- > View this message in context: > http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26801956.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Cheers, Jon Camel in Action: http://manning.com/ibsen Blog: http://janstey.blogspot.com