Camel Pipeline not available from XML?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel Pipeline not available from XML?

raulvk
Hi everyone,

I am using Camel embedded inside ServiceMix. In order to provide better configuration uniformity across the whole SOA deployment, and for architectural reasons, we have chosen to configure Camel routes using the Spring XML method instead of using Java DSL.

However, I have noticed that the Pipeline pattern is only available from Java DSL, as the element is not defined in the Camel XSD located at: http://activemq.apache.org/camel/schema/spring/camel-spring.xsd.

Is this a bug? Is the Pipeline pattern actually configurable via Spring XML even though it does not appear in the XML Schema?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available from XML?

Aaron Crickenberger

On Mar 27, 2008, at 1:32 PM, raulvk wrote:

> However, I have noticed that the Pipeline pattern is only available  
> from
> Java DSL, as the element is not defined in the Camel XSD located at:
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd.

As I understand it, pipelines are implicitly created when specifying  
routes via XML.  The following should be equivalent to the example  
found at http://activemq.apache.org/camel/pipes-and-filters.html

<route>
        <from uri="direct:a"/>
        <to uri="direct:x"/>
        <to uri="direct:y"/>
        <to uri="direct:z"/>
        <to uri="mock:result"/>
</route>

You have to explicitly specify multicast if this isn't the behavior  
you want.  I think it would look like this?
<route>
        <from uri="direct:a"/>
        <multicast>
                <to uri="direct:x"/>
                <to uri="direct:y"/>
                <to uri="direct:z"/>
                <to uri="mock:result"/>
        </multicast>
</route>

If you turn on DEBUG level logging when running Camel's unit tests or  
examples, you'll see a lot of information about what routing  
constructs are used under the hood.

Hope this helps!

- aaron
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available from XML?

raulvk
Aaron,

Thanks a lot for your help. I will follow your tip and will notch the logging level up to DEBUG ;)

However, as far as I know (I've read this somewhere but I can't recall where), when you specify multiple recipients following the syntax you specified (multiple <to> elements or <multicast>), what happens is that the same initial message gets routed to all the recipients. What I want to achieve is a "sequence of invocations", where each recipient gets the result of the processing done by the previous one.

Perhaps someone could shed some light on this??

Thanks a lot!!


Aaron Crickenberger wrote
On Mar 27, 2008, at 1:32 PM, raulvk wrote:

> However, I have noticed that the Pipeline pattern is only available  
> from
> Java DSL, as the element is not defined in the Camel XSD located at:
> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd.

As I understand it, pipelines are implicitly created when specifying  
routes via XML.  The following should be equivalent to the example  
found at http://activemq.apache.org/camel/pipes-and-filters.html

<route>
        <from uri="direct:a"/>
        <to uri="direct:x"/>
        <to uri="direct:y"/>
        <to uri="direct:z"/>
        <to uri="mock:result"/>
</route>

You have to explicitly specify multicast if this isn't the behavior  
you want.  I think it would look like this?
<route>
        <from uri="direct:a"/>
        <multicast>
                <to uri="direct:x"/>
                <to uri="direct:y"/>
                <to uri="direct:z"/>
                <to uri="mock:result"/>
        </multicast>
</route>

If you turn on DEBUG level logging when running Camel's unit tests or  
examples, you'll see a lot of information about what routing  
constructs are used under the hood.

Hope this helps!

- aaron
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available from XML?

jstrachan
On 27/03/2008, raulvk <[hidden email]> wrote:

>
>
>  Aaron,
>
>  Thanks a lot for your help. I will follow your tip and will notch the
>  logging level up to DEBUG ;)
>
>  However, as far as I know (I've read this somewhere but I can't recall
>  where), when you specify multiple recipients following the syntax you
>  specified (multiple <to> elements or <multicast>), what happens is that the
>  same initial message gets routed to all the recipients.
> What I want to
>  achieve is a "sequence of invocations", where each recipient gets the result
>  of the processing done by the previous one.

Yes thats what happens when you use the first form...

<route>
       <from uri="direct:a"/>
       <to uri="direct:x"/>
       <to uri="direct:y"/>
       <to uri="direct:z"/>
       <to uri="mock:result"/>
</route>

that is the result of x is sent to y and the result of that sent to z etc.

If you want the same message to be sent separately to each endpoint,
then thats what <multicast> does (i.e. each recipient gets its own
copy).

<route>
       <from uri="direct:a"/>
       <multicast>
               <to uri="direct:x"/>
               <to uri="direct:y"/>
               <to uri="direct:z"/>
               <to uri="mock:result"/>
       </multicast>
</route>
--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available in XML

jstrachan
In reply to this post by raulvk
On 27/03/2008, raulvk <[hidden email]> wrote:

>
>  Hi everyone,
>
>  I am using Camel embedded inside ServiceMix. In order to provide better
>  configuration uniformity across the whole SOA deployment, and for
>  architectural reasons, we have chosen to configure Camel routes using the
>  Spring XML method instead of using Java DSL.
>
>  However, I have noticed that the Pipeline pattern is only available from
>  Java DSL, as the element is not defined in the Camel XSD located at:
>  http://activemq.apache.org/camel/schema/spring/camel-spring.xsd.
>
>  Is this a bug? Is the Pipeline pattern actually configurable via Spring XML
>  even though it does not appear in the XML Schema?

If you're searching the archive this thread was answered here:
http://www.nabble.com/Camel-Pipeline-not-available-from-XML--tp16329178s22882p16329178.html

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available from XML?

hadrian
In reply to this post by jstrachan
One caveat is that if y, for instance, is an InOnly than z will not  
receive the out of y (null), but the *in* of y.

Cheers
Hadrian

On Mar 28, 2008, at 4:17 AM, James Strachan wrote:

> On 27/03/2008, raulvk <[hidden email]> wrote:
>>
>>
>> Aaron,
>>
>> Thanks a lot for your help. I will follow your tip and will notch the
>> logging level up to DEBUG ;)
>>
>> However, as far as I know (I've read this somewhere but I can't  
>> recall
>> where), when you specify multiple recipients following the syntax you
>> specified (multiple <to> elements or <multicast>), what happens is  
>> that the
>> same initial message gets routed to all the recipients.
>> What I want to
>> achieve is a "sequence of invocations", where each recipient gets  
>> the result
>> of the processing done by the previous one.
>
> Yes thats what happens when you use the first form...
>
> <route>
>       <from uri="direct:a"/>
>       <to uri="direct:x"/>
>       <to uri="direct:y"/>
>       <to uri="direct:z"/>
>       <to uri="mock:result"/>
> </route>
>
> that is the result of x is sent to y and the result of that sent to  
> z etc.
>
> If you want the same message to be sent separately to each endpoint,
> then thats what <multicast> does (i.e. each recipient gets its own
> copy).
>
> <route>
>       <from uri="direct:a"/>
>       <multicast>
>               <to uri="direct:x"/>
>               <to uri="direct:y"/>
>               <to uri="direct:z"/>
>               <to uri="mock:result"/>
>       </multicast>
> </route>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com

Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available in XML

raulvk
In reply to this post by jstrachan
Hi, could you please check the URL? It points to this thread.

Thanks!

James.Strachan wrote
If you're searching the archive this thread was answered here:
http://www.nabble.com/Camel-Pipeline-not-available-from-XML--tp16329178s22882p16329178.html

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: Camel Pipeline not available in XML

jstrachan
On 28/03/2008, raulvk <[hidden email]> wrote:
>
>  Hi, could you please check the URL? It points to this thread.

Hmm on the apache lists I seem to get multiple mails :) Though nabble
has just one :)

http://www.nabble.com/Camel-Pipeline-not-available-from-XML--td16329178s22882.html

sorry for the noise nabble surfers

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com