You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by klausb <kl...@hp.com> on 2010/11/29 15:13:19 UTC

Question on VM Endpoint, multipleConsumers and OSGi

I'm using camel 2.5.0 and try to setup a simple pub-sub behavior among three
OSGi bundles. 
One bundle (writer) is sending messages via 
    to("vm:discovery?multipleConsumers=true") 

The two other bundles (listener) receive messages via 
    from("vm:discovery?multipleConsumers=true") 

All bundles are loaded into Apache Karaf. 

If I start all three listener bundles and finally start the writer only
one(!) listener reports that the packet was received. I expected log
messages from both listeners due to multipleConsumers=true. 

Did I misunderstood the vm option? 

klaus.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3284450.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I add a little note to the option in the table of the docs.

On Wed, Feb 8, 2012 at 5:39 AM, vivekvasudeva <tu...@yahoo.com> wrote:
> I switched it to having multipleConsumers=true for all. Worked like a charm
> ...Is it possible to put it in the component doc of seda that to accomplish
> the pubsub, the multipleConsumers is needed on all places. Is there anything
> I can do to help put the same? Also to test the above I used the below
>                from("timer://foo?fixedRate=true&delay=10&period=1s")
>                .setBody(constant("Hello world!"))
>                .to("seda:dump");
>
>                from("seda:dump?multipleConsumers=true").routeId("one")
>                .log("one: + ${body}");
>
>                from("seda:dump?multipleConsumers=true").routeId("two")
>                .log("two: + ${body}");
>
>                from("seda:dump?multipleConsumers=true").routeId("three")
>                .log("three: + ${body}");
>
>        context.start();
>        Thread.sleep(10000);
>        context.stopRoute("two");
>        context.removeRoute("two");
>        Thread.sleep(10000);
>        context.stop();
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p5465523.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by vivekvasudeva <tu...@yahoo.com>.
I switched it to having multipleConsumers=true for all. Worked like a charm
...Is it possible to put it in the component doc of seda that to accomplish
the pubsub, the multipleConsumers is needed on all places. Is there anything
I can do to help put the same? Also to test the above I used the below
                from("timer://foo?fixedRate=true&delay=10&period=1s")
                .setBody(constant("Hello world!"))
                .to("seda:dump");        
                
                from("seda:dump?multipleConsumers=true").routeId("one")
                .log("one: + ${body}");     
                
                from("seda:dump?multipleConsumers=true").routeId("two")
                .log("two: + ${body}");                
                
                from("seda:dump?multipleConsumers=true").routeId("three")
                .log("three: + ${body}");                
                
        context.start();
        Thread.sleep(10000);
        context.stopRoute("two");
        context.removeRoute("two");
        Thread.sleep(10000);
        context.stop();

--
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p5465523.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

And you have multipleConsumers=true on all your seda endpoints?


On Sat, Feb 4, 2012 at 11:14 PM, vivekvasudeva <tu...@yahoo.com> wrote:
> Hey,
> I have a very similar issue ...of multipleConsumers not working as expected
> //Master class
> from(jmx:.....xyz)
> .log("master" + $body)
> .to(seda:myq?multipleConsumers=true)
>
> // Consumer class
> from("seda:myq).routeId(consumerId)
> .log(consumerId + $body)
>
> only the 1st consumer gets the message and logs it
> The 2nd, 3rd consumers does not print the message ??
>
> So how is it true pub-sub ?
>
> Vivek
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p5457045.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by vivekvasudeva <tu...@yahoo.com>.
Hey, 
I have a very similar issue ...of multipleConsumers not working as expected
//Master class
from(jmx:.....xyz)
.log("master" + $body)
.to(seda:myq?multipleConsumers=true)

// Consumer class
from("seda:myq).routeId(consumerId)
.log(consumerId + $body)

only the 1st consumer gets the message and logs it 
The 2nd, 3rd consumers does not print the message ??

So how is it true pub-sub ?

Vivek 

--
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p5457045.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Have you used DEBUG logging at the seda component to see what happens?
It logs when it send to a consumer.



On Mon, Nov 29, 2010 at 3:13 PM, klausb <kl...@hp.com> wrote:
>
> I'm using camel 2.5.0 and try to setup a simple pub-sub behavior among three
> OSGi bundles.
> One bundle (writer) is sending messages via
>    to("vm:discovery?multipleConsumers=true")
>
> The two other bundles (listener) receive messages via
>    from("vm:discovery?multipleConsumers=true")
>
> All bundles are loaded into Apache Karaf.
>
> If I start all three listener bundles and finally start the writer only
> one(!) listener reports that the packet was received. I expected log
> messages from both listeners due to multipleConsumers=true.
>
> Did I misunderstood the vm option?
>
> klaus.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3284450.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by klausb <kl...@hp.com>.
Hi Guillaume,

with the standard featuresRepositories from Karaf the attempt to load the
nmr deature fails (feature is unknown). Therefore I added the servicemix
repositories to it. Now I see an unresolved constraint:

Error executing command: Could not start bundle
mvn:org.apache.felix.karaf.deployer/org.apache.felix.karaf.deployer.spring/1.2.0
in feature(s) : Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [132]: Unable to resolve 132.0:
missing requirement [132.0] package;
(&(package=org.apache.felix.fileinstall)(version>=2.0.0)(!(version>=3.0.0)))

To me its unclear which bundle is missing here.

klaus.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3286195.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Guillaume Nodet <gn...@gmail.com>.
Try "features:install nmr" ...

On Tue, Nov 30, 2010 at 14:38, klausb <kl...@hp.com> wrote:
>
> Can I use NMR inside pure Karaf? I mean without using a complete ServiceMix
> installation.
> What features do I need to install?
>
> klaus.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3286154.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by klausb <kl...@hp.com>.
Can I use NMR inside pure Karaf? I mean without using a complete ServiceMix
installation.
What features do I need to install?

klaus.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3286154.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
The NMR can pass in any kind of objects.

Its the JBI which has to normalize to XML. (due the spec. says so)

On Tue, Nov 30, 2010 at 9:21 AM, klausb <kl...@hp.com> wrote:
>
> Hi Claus,
>
> I was explicitely heading to camel to avoid XMl marshaling for NMR.
> I need pretty high performance to  pass messages around. Therefore I want to
> leave them in their native format (POJOs). That's where Camel comes along
> very handy.
> At the same time the VM endpoint promised the pub-sub feature which also
> jumps into a requirement.
> Do you have other alternative in mind than using VM for pub-sub with high
> throughput?
>
> Btw. The non-OSGi test to verify my assumption on multipleConsumers with VM
> failed. I created three camel contexts (one sender, two receivers).
>
> klaus.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3285739.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by klausb <kl...@hp.com>.
Hi Claus,

I was explicitely heading to camel to avoid XMl marshaling for NMR.
I need pretty high performance to  pass messages around. Therefore I want to
leave them in their native format (POJOs). That's where Camel comes along
very handy.
At the same time the VM endpoint promised the pub-sub feature which also
jumps into a requirement.
Do you have other alternative in mind than using VM for pub-sub with high
throughput?

Btw. The non-OSGi test to verify my assumption on multipleConsumers with VM
failed. I created three camel contexts (one sender, two receivers).

klaus.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3285739.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Nov 29, 2010 at 3:20 PM, klausb <kl...@hp.com> wrote:
>
> Ok, but should it work? Is my assumption correct?

The VM wasn't really meant for osgi. It was for sharing messages
between WAR files deployed in Apache Tomcat etc.
In OSGi there are OSGi services and/or the NMR component for sharing
messages between bundles.



>
> klaus.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3284467.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by klausb <kl...@hp.com>.
Ok, but should it work? Is my assumption correct?

klaus.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3284467.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question on VM Endpoint, multipleConsumers and OSGi

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Try from an unit test outside Karaf / OSGi first, to make sure it works there.
Then we know its more an issue when using OSGi.



On Mon, Nov 29, 2010 at 3:13 PM, klausb <kl...@hp.com> wrote:
>
> I'm using camel 2.5.0 and try to setup a simple pub-sub behavior among three
> OSGi bundles.
> One bundle (writer) is sending messages via
>    to("vm:discovery?multipleConsumers=true")
>
> The two other bundles (listener) receive messages via
>    from("vm:discovery?multipleConsumers=true")
>
> All bundles are loaded into Apache Karaf.
>
> If I start all three listener bundles and finally start the writer only
> one(!) listener reports that the packet was received. I expected log
> messages from both listeners due to multipleConsumers=true.
>
> Did I misunderstood the vm option?
>
> klaus.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-on-VM-Endpoint-multipleConsumers-and-OSGi-tp3284450p3284450.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/