Louis, actually, there is no difference, end() is implicit. There would be a difference if you had something like:

multicast ().to("direct:x").to("direct:y").to("direct:z").end().to("direct:a")

Without the end() they'd be all done in parallel, with end() "direct:a" is done after all the other exchanges finish. The reason end() is optional is because Blocks were added a bit later (in 1.3 iirc) and we wanted to keep backwards compatibility, i.e. not make end() mandatory and have existing users update their routes.

My $0.02,
Hadrian


On Nov 1, 2008, at 4:41 AM, davsclaus wrote:


Hi

A bit late with the answer, but Camel uses Pipeline (pipes and filters EIP
pattern) by default, when doing directly routing from -> to.

There is a FAQ entry here:
http://activemq.apache.org/camel/how-to-send-the-same-message-to-multiple-endpoints.html

Multicast = same message being sent to all destinations
Pipeline = like a chain (pipes and filters).

/Claus, a Camel rider



Louis Polycarpou wrote:

Thanks. I'll try that.  The multicast fluent builder example
http://activemq.apache.org/camel/multicast.html here doesn't use end:

from("direct:a").multicast().to("direct:x", "direct:y", "direct:z");

What's the difference between:

multicast().to("direct:x", "direct:y", "direct:z").end();

and

to("direct:x", "direct:y", "direct:z");

Thanks.

Hadrian Zbarcea wrote:

Hi,

Did you try end() to terminate the multicast?  As in:
from(uri).
  choice().
    when(expr).multicast().to(uris).end().
    otherwise().to(pojo);

Cheers
Hadrian


On Aug 6, 2008, at 8:28 PM, Louis Polycarpou wrote:




Louis Polycarpou wrote:

I'm trying to broadcast a feed to multiple endpoints but with
content-based selection. I assume I need to use multicast, however, I
can't achieve conditional multicast based on content selection
since I
can't use an otherwise() method after using
multicast().to("endpoint1",
"endpoint2")

Furthermore, the to() method supports a list of endpoints without
requiring a multicast first so what is the difference between that
and a
multicast().to(...)?

feed in -> multicast to two outputs

To recap with code:

1) I can't use otherwise after a multicast...

      from(cnn).
              choice().
when(xpath(filter)).multicast().to(im, archive); // I
can't now use otherwise()...

2) Do I really need multicast or can I just do the following...?

      from(cnn).
              choice().
              when(xpath(filter)).to(im, archive).
              otherwise().to(myPojo);



One way I've worked around this is to inverse the filter and do the
multicast in the otherwise() part but clearly this doesn't answer my
original question:

from(cnn).
              choice().
              when(xpath(filter)).to(stdout).
              otherwise().multicast().to(im, archive);

--
View this message in context:
http://www.nabble.com/Multicast-with-choice-tp18861976s22882p18862033.html
Sent from the Camel - Users mailing list archive at Nabble.com.







--
View this message in context: 
http://www.nabble.com/Multicast-with-choice-tp18861976s22882p20278430.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Reply via email to