camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Usage of Scala DSL
Date Sun, 15 Jul 2012 19:08:08 GMT
Hi

The multicast will send a copy to all the processors, so in your case,
you have 4 processors
- 2 transform
- 2 logs

I guess what you want is for the transform + log to be a pair. So you
would need to use the pipes and filters eip inside the multicast.
With Scala DSL you can possible do that by a { } block. If not you may
need to use a pipeline { ... } etc.
Then in the pipeline you can do the transform -> log. And then have 2 pipelines.

Hope my rambling makes sense.


On Sun, Jul 15, 2012 at 6:39 PM, Andreas Feldmann
<andi.feldmann@gmail.com> wrote:
> Hallo everybody,
>
> I have a problem regarding the Scala DSL.  I have seen that is quite simple
> to transform
> a string:
>
> "direct:start" ==>
> {
>       transform(_.in[String] + " World!")
>       to("mock:result")
>  }
>
> Source:
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/STransformProcessorTest.scala
>
> Now I have constructed a different route like this:
>
> "quartz://trigger?cron=0/10+*+*+*+*+?&fireNow=true"  ==>
> {
>         transform("foo")
>         to("seda:test")
> }
>
> "seda:test" ==> transform(_.in.toString().toUpperCase()) ==>
> multicast.parallel
> {
>         transform(_.in[String] + " Test 1") log(LoggingLevel.INFO, "TEST",
> "${body}")
>         transform(_.in[String] + " Test 2") log(LoggingLevel.INFO, "TEST",
> "${body}")
> }
>
> So "foo" is send to seda:test. Then "foo" is transformed to "FOO".  But
> after the multicast
> "Test 1" oder "Test 2" are not appended to the message. Ony "FOO" is logged
> and not "FOO Test 1".
>
> I am not a scala expert, but why is this happening?
>
> Thanks in advance for any answers!
>
> Kind regards
>
> Andi
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Usage-of-Scala-DSL-tp5716054.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message