On Sun, Dec 6, 2009 at 4:51 PM, Hendy Irawan <[email protected]> wrote:
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Maybe spring event can be used also?
>> http://camel.apache.org/event.html
>>
>
> I guess that'd mean my message has to be an ApplicationEvent.
>

Dont know if Spring enforces to implement an interface but I would
envision they did.


>
> Claus Ibsen-2 wrote:
>>
>> You can create you own component that offers topic like functionally.
>> You could extend the seda or direct component and implement the logic
>> missing.
>>
>
> Thanks for the encouragement. :-)
>
>
> Claus Ibsen-2 wrote:
>>
>> I would assume adding @Consume to any POJO does not require any routes
>> to pre existing and cannot see why its not dynamic.
>>
>
> Yes indeed, unfortunately @Consume breaks when there are two @Consume'rs on
> the same endpoint that is not a publish-subscribe channel. It seems like
> it's doing round-robin (?) instead of multicast.
>
> For example, I'd like:
>
> /* bean1 */
> @Consume("seda:mychannel") public void Yeeha(String msg) { }
> /* bean2 */
> @Consume("seda:mychannel") public void Yaahi(String msg) { }
>
> to behave as if an explicit route is specified (with multicast):
>
> <from uri="seda:channel">
> <multicast>
>  <to uri="bean:bean1" />
>  <to uri="bean:bean2" />
> </multicast>
> </from>
>
> but right now, it seems messages are being routed round-robin when using the
> @Consumer. That's why I said doing multicast dynamically (with @Consume)
> seem to be not possible.
>

No seda does *not* support multiple consumers. Its meant to be used
with a single consumer only.
In 2.1 this is even enforced. Often end users had copy paste mistakes
and didnt want multiple consumers to the same seda endpoint.
Hence why we enforced this now in 2.1.

What is your use case sine you need this? I am interesting in what you
are trying to solve?


What you could do is to extend seda, and have support multiple
consumers and have the Exchange being copied before its handed out to
every
consumers.

Mind that when you copy the Exchange / Message if the body is not a
simple type such as String then you may only copy a reference to it
and thus have multiple consumers work on it concurrently, and thus you
need to be aware of thread safety issues.

And there is a new interface in Camel 2.1, MultipleConsumersSupport,
which indicates whether an endpoint supports multiple consumers or
not.
You need to implement this and return true in your own component.




> Thank you.
> --
> View this message in context: 
> http://old.nabble.com/Implementing-Publish-Subscribe-Channel-tp26654086p26666101.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to