You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Borner <ma...@zurich.com.au> on 2010/11/04 02:32:32 UTC
Camel 2.5 JPA Difference From 2.4
Hello:
I'm migrating my Camel 2.4 application to Camel 2.5 and I'm experiencing a
route in 2.4 that doesn't work under 2.5.
Here's an extract of the route:
from("{{export.queue}}")
.transacted()
.setHeader(MessageStatusConverter.STATUS,
constant(MessageStatuses.PROCESSING))
.to("jpa:au.com.zurich.phoenix.gateway.domain.MessageStatus")
.to("xslt:stylesheets/Main.xsl")
Property {{export.queue}} is a JMS queue containing a String message.
Under 2.4:
the JPA endpoint would call a Type Converter to convert the String
into a MessageStatus and persist it
the XSLT endpoint would receive the original String message and
use it in the transformation
However Under 2.5:
the JPA endpoint calls a Type Converter to convert the String into
a MessageStatus and persist it (same as Camel 2.4)
BUT the JPA endpoint is now putting the MessageStatus entity into
the Body
So the XSLT endpoint throws an exception:
CaughtExceptionType:org.apache.camel.ExpectedBodyTypeException,
CaughtExceptionMessage:Could not extract IN message body as type:
interface javax.xml.transform.Source body is:
au.com.zurich.phoenix.gateway.domain.MessageStatus@811151c6,
StackTrace:org.apache.camel.ExpectedBodyTypeException: Could not extract
IN message body as type: interface javax.xml.transform.Source body is:
au.com.zurich.phoenix.gateway.domain.MessageStatus@811151c6
Could someone confirm that this is a behaviour change between 2.4 and 2.5?
And provide me with a work around/change to achieve what I previously
could achieve?
Thanks,
Mark
Mark Borner
Java Developer - ZStream Xpress
----
This email is intended for the named recipient only. It may contain
information which is confidential, commercially sensitive, or
copyright. If you are not the intended recipient you must not
reproduce or distribute any part of the email, disclose its contents,
or take any action in reliance. If you have received this email in
error, please contact the sender and delete the message. It is your
responsibility to scan this email and any attachments for viruses and
other defects. To the extent permitted by law, Zurich and its
associates will not be liable for any loss or damage arising in any
way from this communication including any file attachments. We may
monitor email you send to us, either as a reply to this email or any
email you send to us, to confirm our systems are protected and for
compliance with company policies. Although we take reasonable
precautions to protect the confidentiality of our email systems, we
do not warrant the confidentiality or security of email or
attachments we receive.
Re: Camel 2.5 JPA Difference From 2.4
Posted by Claus Ibsen <cl...@gmail.com>.
You need to learn the EIP patterns
What you want is to send the same message to multiple recipients. (same
message to jpa and xslt)
For example the Multicast or Recipient List EIP pattern.
On Thu, Nov 4, 2010 at 2:32 AM, Mark Borner <ma...@zurich.com.au>wrote:
>
> Hello:
>
> I'm migrating my Camel 2.4 application to Camel 2.5 and I'm experiencing a
> route in 2.4 that doesn't work under 2.5.
>
> Here's an extract of the route:
>
> from("{{export.queue}}")
> .transacted()
> .setHeader(MessageStatusConverter.STATUS,
> constant(MessageStatuses.PROCESSING))
>
> .to("jpa:au.com.zurich.phoenix.gateway.domain.MessageStatus")
> .to("xslt:stylesheets/Main.xsl")
>
> Property {{export.queue}} is a JMS queue containing a String message.
>
> Under 2.4:
>
> the JPA endpoint would call a Type Converter to convert the String
> into a MessageStatus and persist it
> the XSLT endpoint would receive the *original String message* and
> use it in the transformation
>
> However Under 2.5:
>
> the JPA endpoint calls a Type Converter to convert the String into
> a MessageStatus and persist it (same as Camel 2.4)
> BUT the JPA endpoint is now putting the MessageStatus entity into
> the Body
> So the XSLT endpoint throws an exception:
> CaughtExceptionType:org.apache.camel.ExpectedBodyTypeException,
> CaughtExceptionMessage:Could not extract IN message body as type: interface
> javax.xml.transform.Source body is:
> au.com.zurich.phoenix.gateway.domain.MessageStatus@811151c6,
> StackTrace:org.apache.camel.ExpectedBodyTypeException: Could not extract IN
> message body as type: interface javax.xml.transform.Source body is:
> au.com.zurich.phoenix.gateway.domain.MessageStatus@811151c6
>
> Could someone confirm that this is a behaviour change between 2.4 and 2.5?
> And provide me with a work around/change to achieve what I previously could
> achieve?
>
> Thanks,
> Mark
>
> Mark Borner
> Java Developer - ZStream Xpress
>
>
>
>
> ----
> This email is intended for the named recipient only. It may contain
> information which is confidential, commercially sensitive, or
> copyright. If you are not the intended recipient you must not
> reproduce or distribute any part of the email, disclose its contents,
> or take any action in reliance. If you have received this email in
> error, please contact the sender and delete the message. It is your
> responsibility to scan this email and any attachments for viruses and
> other defects. To the extent permitted by law, Zurich and its
> associates will not be liable for any loss or damage arising in any
> way from this communication including any file attachments. We may
> monitor email you send to us, either as a reply to this email or any
> email you send to us, to confirm our systems are protected and for
> compliance with company policies. Although we take reasonable
> precautions to protect the confidentiality of our email systems, we
> do not warrant the confidentiality or security of email or
> attachments we receive.
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Camel 2.5 JPA Difference From 2.4
Posted by Richard Kettelerij <ri...@gmail.com>.
This behavior hasn't changed between 2.4 and 2.5. The behavior that you're
experiencing with 2.5 should also occur when using 2.4. What you have is a
pipeline while you should be using a multicast. The following code behaves
like you expect as described under 2.4:
from("{{export.queue}}")
.transacted()
.setHeader(MessageStatusConverter.STATUS,
constant(MessageStatuses.PROCESSING))
.multicast()
.to("jpa:au.com.zurich.phoenix.gateway.domain.MessageStatus")
.to("xslt:stylesheets/Main.xsl")
Take a look at the EIP patterns (pipes and filters, multicast, etc) as Claus
suggested. More details about EIP can be found in the Camel in Action book.
-----
Richard Kettelerij,
http://github.com/rkettelerij
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-5-JPA-Difference-From-2-4-tp3249404p3250919.html
Sent from the Camel - Users mailing list archive at Nabble.com.