You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Otho <ta...@googlemail.com> on 2012/02/29 19:32:41 UTC

Camel routing to address specific users with ActiveMQ/stomp over websockets.

Hey all,

I have the following use-case:

Users connect to activemq via stomp over websockets and register with a
UUID (works).
Users subscribe to different general topics and get notification by that
(works).

Now I need the following extensions:

Users create -at runtime- custom topics with restricted usergroups.
Users have a private queue -created at runtime with the UUID they
registered with- where they get sent server push notifications which are
only meant for them.

My idea is to create routes at runtime for these extensions. How would I go
about this? Since the UUIDs and the names  of the custom created topics
(think channels on IRC) are not known in advance I can't put them in xml
files or something similar.

So my question is: Is that in any way possible with camel/activemq tandem
or do I have to do it directly with activemq in this case? If possible any
pointer would be helpful.

Regards,
Otho

Re: Camel routing to address specific users with ActiveMQ/stomp over websockets.

Posted by Otho <ta...@googlemail.com>.
Thank your two very much for the helpful tips and links.

Regards,
Otho

Am 1. März 2012 15:11 schrieb Claus Ibsen <cl...@gmail.com>:

> On Wed, Feb 29, 2012 at 7:32 PM, Otho <ta...@googlemail.com> wrote:
> > Hey all,
> >
> > I have the following use-case:
> >
> > Users connect to activemq via stomp over websockets and register with a
> > UUID (works).
> > Users subscribe to different general topics and get notification by that
> > (works).
> >
> > Now I need the following extensions:
> >
> > Users create -at runtime- custom topics with restricted usergroups.
> > Users have a private queue -created at runtime with the UUID they
> > registered with- where they get sent server push notifications which are
> > only meant for them.
> >
> > My idea is to create routes at runtime for these extensions. How would I
> go
> > about this? Since the UUIDs and the names  of the custom created topics
> > (think channels on IRC) are not known in advance I can't put them in xml
> > files or something similar.
> >
>
> You can add / remove / edit routes at runtime. There is API on
> CamelContext to add/remove the routes etc.
>
> For Java based routes you can create a skeleton route as a
> RouteBuilder, and then just instantiate a new instance of that class,
> and then configure it using getter/setters etc for the uris and
> whatnot. And then in the configure method of the RouteBuilder you can
> create  the route using the DSL.
>
> With XML you can fully create a new route and add it. There is a look
> example here
> http://camel.apache.org/loading-routes-from-xml-files.html
>
> > So my question is: Is that in any way possible with camel/activemq tandem
> > or do I have to do it directly with activemq in this case? If possible
> any
> > pointer would be helpful.
> >
> > Regards,
> > Otho
>
>
>
> --
> 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: Camel routing to address specific users with ActiveMQ/stomp over websockets.

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 29, 2012 at 7:32 PM, Otho <ta...@googlemail.com> wrote:
> Hey all,
>
> I have the following use-case:
>
> Users connect to activemq via stomp over websockets and register with a
> UUID (works).
> Users subscribe to different general topics and get notification by that
> (works).
>
> Now I need the following extensions:
>
> Users create -at runtime- custom topics with restricted usergroups.
> Users have a private queue -created at runtime with the UUID they
> registered with- where they get sent server push notifications which are
> only meant for them.
>
> My idea is to create routes at runtime for these extensions. How would I go
> about this? Since the UUIDs and the names  of the custom created topics
> (think channels on IRC) are not known in advance I can't put them in xml
> files or something similar.
>

You can add / remove / edit routes at runtime. There is API on
CamelContext to add/remove the routes etc.

For Java based routes you can create a skeleton route as a
RouteBuilder, and then just instantiate a new instance of that class,
and then configure it using getter/setters etc for the uris and
whatnot. And then in the configure method of the RouteBuilder you can
create  the route using the DSL.

With XML you can fully create a new route and add it. There is a look
example here
http://camel.apache.org/loading-routes-from-xml-files.html

> So my question is: Is that in any way possible with camel/activemq tandem
> or do I have to do it directly with activemq in this case? If possible any
> pointer would be helpful.
>
> Regards,
> Otho



-- 
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: Camel routing to address specific users with ActiveMQ/stomp over websockets.

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

BTW, while the solution presented in my earlier note is quite nice, there
are even more elegant ways of doing this with the cool new zookeeper
component in Camel 2.9. However this requires that the URLs be stored in
zookeeper and that a route be constructed on the fly based on changes in
Zookeeper.

I will leave this to you to figure out.

Hope this helps.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-to-address-specific-users-with-ActiveMQ-stomp-over-websockets-tp5525746p5527934.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel routing to address specific users with ActiveMQ/stomp over websockets.

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Camel has an ability to deploy routes in a camel context at runtime...
Please check out the unit test below that shows how to do that...

https://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/AddRoutesAtRuntimeTest.java?view=markup
https://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/AddRoutesAtRuntimeTest.java?view=markup 

Hope this helps.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-routing-to-address-specific-users-with-ActiveMQ-stomp-over-websockets-tp5525746p5527927.html
Sent from the Camel - Users mailing list archive at Nabble.com.