You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dhavalsdoshi <dh...@gmail.com> on 2013/03/27 15:30:00 UTC
Handle multiple exceptions in scala dsl
Hi,
What's the equivalent syntax in Scala DSL for doing the following Java DSL
onException(IOException.class, SQLException.class,
JMSException.class).maximumRedeliveries(5)....
Scala DSL only has
handle[T]
which can take only one exception type, I believe.Please help.
--
View this message in context: http://camel.465427.n5.nabble.com/Handle-multiple-exceptions-in-scala-dsl-tp5729941.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Handle multiple exceptions in scala dsl
Posted by Willem jiang <wi...@gmail.com>.
After digging the code for a while, I found it is impossible to set the multiple exceptions into handle method, as it use implicit manifest parameter to pass the Class related information.
Here is a workaround by calling the onException method directly in the scala code like this
builder.onException(Class[MyFunctionalException], Class[MyTechnicalException]).to("mock:error").handled(true)
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Thursday, March 28, 2013 at 12:01 PM, Willem jiang wrote:
> Hi
>
> I just filled a JIRA[1] for it, and will try to fix it today.
>
> [1]https://issues.apache.org/jira/browse/CAMEL-6221
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Thursday, March 28, 2013 at 1:09 AM, Claus Ibsen wrote:
>
> > On Wed, Mar 27, 2013 at 3:30 PM, dhavalsdoshi <dhaval.doshi@gmail.com (mailto:dhaval.doshi@gmail.com) (mailto:dhaval.doshi@gmail.com)> wrote:
> > > Hi,
> > > What's the equivalent syntax in Scala DSL for doing the following Java DSL
> > > onException(IOException.class, SQLException.class,
> > > JMSException.class).maximumRedeliveries(5)....
> > > Scala DSL only has
> > > handle[T]
> > > which can take only one exception type, I believe.Please help.
> > >
> >
> >
> >
> >
> >
> > Ah that may be a limitation in the Scala DSL.
> >
> > Feel free to log a JIRA ticket for an enhancement. So the Scala DSL
> > accepts multiple like the Java DSL
> > http://camel.apache.org/support
> >
> >
> > >
> > >
> > > --
> > > View this message in context: http://camel.465427.n5.nabble.com/Handle-multiple-exceptions-in-scala-dsl-tp5729941.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com) (http://Nabble.com).
> > >
> >
> >
> >
> >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Email: cibsen@redhat.com (mailto:cibsen@redhat.com) (mailto:cibsen@redhat.com)
> > Web: http://fusesource.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
>
>
Re: Handle multiple exceptions in scala dsl
Posted by Willem jiang <wi...@gmail.com>.
Hi
I just filled a JIRA[1] for it, and will try to fix it today.
[1]https://issues.apache.org/jira/browse/CAMEL-6221
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Thursday, March 28, 2013 at 1:09 AM, Claus Ibsen wrote:
> On Wed, Mar 27, 2013 at 3:30 PM, dhavalsdoshi <dhaval.doshi@gmail.com (mailto:dhaval.doshi@gmail.com)> wrote:
> > Hi,
> > What's the equivalent syntax in Scala DSL for doing the following Java DSL
> > onException(IOException.class, SQLException.class,
> > JMSException.class).maximumRedeliveries(5)....
> > Scala DSL only has
> > handle[T]
> > which can take only one exception type, I believe.Please help.
>
>
>
> Ah that may be a limitation in the Scala DSL.
>
> Feel free to log a JIRA ticket for an enhancement. So the Scala DSL
> accepts multiple like the Java DSL
> http://camel.apache.org/support
>
>
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.com/Handle-multiple-exceptions-in-scala-dsl-tp5729941.html
> > Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
>
>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
Re: Handle multiple exceptions in scala dsl
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 27, 2013 at 3:30 PM, dhavalsdoshi <dh...@gmail.com> wrote:
> Hi,
> What's the equivalent syntax in Scala DSL for doing the following Java DSL
> onException(IOException.class, SQLException.class,
> JMSException.class).maximumRedeliveries(5)....
> Scala DSL only has
> handle[T]
> which can take only one exception type, I believe.Please help.
>
Ah that may be a limitation in the Scala DSL.
Feel free to log a JIRA ticket for an enhancement. So the Scala DSL
accepts multiple like the Java DSL
http://camel.apache.org/support
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Handle-multiple-exceptions-in-scala-dsl-tp5729941.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen