Appropriate use case for Camel?

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

Appropriate use case for Camel?

paul.dlug@gmail.com
Hopefully this is an easy answer. I'm a bit unclear on how Camel
should actually be used. I'm currently using ActiveMQ to do some basic
integration between applications in Java, Ruby, Perl, primarily via
STOMP. I'd like to use Camel to apply some of the enterprise
integration patterns, especially as it applies to routing as well as
using some of the built in connectors. From a quick read through the
docs it appears that I need to build Camel into an application itself
(in a servlet container or via spring). Is it possible to just run
Camel inside an ActiveMQ server to configure queues and handle routing
and other patterns? The ActiveMQ container itself provides good
management services and failover so I'd hate to deploy a separate
application that my services will need to interact with since it
introduces another point of failure.

Please also let me me know if I'm thinking about this completely wrong...


Thanks,
Paul
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

jstrachan
On 7/3/07, Paul Dlug <[hidden email]> wrote:

> Hopefully this is an easy answer. I'm a bit unclear on how Camel
> should actually be used. I'm currently using ActiveMQ to do some basic
> integration between applications in Java, Ruby, Perl, primarily via
> STOMP. I'd like to use Camel to apply some of the enterprise
> integration patterns, especially as it applies to routing as well as
> using some of the built in connectors. From a quick read through the
> docs it appears that I need to build Camel into an application itself
> (in a servlet container or via spring). Is it possible to just run
> Camel inside an ActiveMQ server to configure queues and handle routing
> and other patterns?

Absolutely! Actually its on my list of things to do to provide some
examples of how to drop camel into the activemq.xml file.

I guess the main use cases are

* run Camel inside the ActiveMQ broker
* run Camel inside a WAR in your Tomcat
* use Camel inside your application

The main thing that is required to use Camel inside ActiveMQ is to add
the camel jars into the lib/*  directory somewhere; then just add some
Camel XML into the activemq.xml file.


> The ActiveMQ container itself provides good
> management services and failover so I'd hate to deploy a separate
> application that my services will need to interact with since it
> introduces another point of failure.

Definitely!

I'd like to actually include Camel by default in the ActiveMQ server;
so folks can see how easy it is to do some smart routing in the broker
etc. (Given its a trivial bit of XML inside the activemq.xml its gonna
be easy for folks to comment it out if they want).

I've raised a JIRA for this - hopefully I can get something sorted
pretty soon...
https://issues.apache.org/activemq/browse/AMQ-1307
--
James
-------
http://macstrac.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

jstrachan
On 7/3/07, James Strachan <[hidden email]> wrote:

> On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > Hopefully this is an easy answer. I'm a bit unclear on how Camel
> > should actually be used. I'm currently using ActiveMQ to do some basic
> > integration between applications in Java, Ruby, Perl, primarily via
> > STOMP. I'd like to use Camel to apply some of the enterprise
> > integration patterns, especially as it applies to routing as well as
> > using some of the built in connectors. From a quick read through the
> > docs it appears that I need to build Camel into an application itself
> > (in a servlet container or via spring). Is it possible to just run
> > Camel inside an ActiveMQ server to configure queues and handle routing
> > and other patterns?
>
> Absolutely! Actually its on my list of things to do to provide some
> examples of how to drop camel into the activemq.xml file.

Actually it turned out to be way easier than I thought!

http://cwiki.apache.org/ACTIVEMQ/enterprise-integration-patterns.html

So you could just download tomorrows 5.0 snapshot and you're good to go...


> I've raised a JIRA for this - hopefully I can get something sorted
> pretty soon...
> https://issues.apache.org/activemq/browse/AMQ-1307

Sorted! :)
--
James
-------
http://macstrac.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

paul.dlug@gmail.com
On 7/3/07, James Strachan <[hidden email]> wrote:

> On 7/3/07, James Strachan <[hidden email]> wrote:
> > On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > > Hopefully this is an easy answer. I'm a bit unclear on how Camel
> > > should actually be used. I'm currently using ActiveMQ to do some basic
> > > integration between applications in Java, Ruby, Perl, primarily via
> > > STOMP. I'd like to use Camel to apply some of the enterprise
> > > integration patterns, especially as it applies to routing as well as
> > > using some of the built in connectors. From a quick read through the
> > > docs it appears that I need to build Camel into an application itself
> > > (in a servlet container or via spring). Is it possible to just run
> > > Camel inside an ActiveMQ server to configure queues and handle routing
> > > and other patterns?
> >
> > Absolutely! Actually its on my list of things to do to provide some
> > examples of how to drop camel into the activemq.xml file.
>
> Actually it turned out to be way easier than I thought!
>
> http://cwiki.apache.org/ACTIVEMQ/enterprise-integration-patterns.html
>
> So you could just download tomorrows 5.0 snapshot and you're good to go...

Thanks James! I've been building 5.0 from subversion anyway so I just
updated my local copy and I'll give this a shot.


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

Re: Appropriate use case for Camel?

jstrachan
On 7/3/07, Paul Dlug <[hidden email]> wrote:

> On 7/3/07, James Strachan <[hidden email]> wrote:
> > On 7/3/07, James Strachan <[hidden email]> wrote:
> > > On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > > > Hopefully this is an easy answer. I'm a bit unclear on how Camel
> > > > should actually be used. I'm currently using ActiveMQ to do some basic
> > > > integration between applications in Java, Ruby, Perl, primarily via
> > > > STOMP. I'd like to use Camel to apply some of the enterprise
> > > > integration patterns, especially as it applies to routing as well as
> > > > using some of the built in connectors. From a quick read through the
> > > > docs it appears that I need to build Camel into an application itself
> > > > (in a servlet container or via spring). Is it possible to just run
> > > > Camel inside an ActiveMQ server to configure queues and handle routing
> > > > and other patterns?
> > >
> > > Absolutely! Actually its on my list of things to do to provide some
> > > examples of how to drop camel into the activemq.xml file.
> >
> > Actually it turned out to be way easier than I thought!
> >
> > http://cwiki.apache.org/ACTIVEMQ/enterprise-integration-patterns.html
> >
> > So you could just download tomorrows 5.0 snapshot and you're good to go...
>
> Thanks James! I've been building 5.0 from subversion anyway so I just
> updated my local copy and I'll give this a shot.

Great! Let us know how you get on & if there's anything we can do to
make it easier to use Camel from inside the ActiveMQ broker

--
James
-------
http://macstrac.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

paul.dlug@gmail.com
On 7/3/07, James Strachan <[hidden email]> wrote:

> On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > On 7/3/07, James Strachan <[hidden email]> wrote:
> > > On 7/3/07, James Strachan <[hidden email]> wrote:
> > > > On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > > > > Hopefully this is an easy answer. I'm a bit unclear on how Camel
> > > > > should actually be used. I'm currently using ActiveMQ to do some basic
> > > > > integration between applications in Java, Ruby, Perl, primarily via
> > > > > STOMP. I'd like to use Camel to apply some of the enterprise
> > > > > integration patterns, especially as it applies to routing as well as
> > > > > using some of the built in connectors. From a quick read through the
> > > > > docs it appears that I need to build Camel into an application itself
> > > > > (in a servlet container or via spring). Is it possible to just run
> > > > > Camel inside an ActiveMQ server to configure queues and handle routing
> > > > > and other patterns?
> > > >
> > > > Absolutely! Actually its on my list of things to do to provide some
> > > > examples of how to drop camel into the activemq.xml file.
> > >
> > > Actually it turned out to be way easier than I thought!
> > >
> > > http://cwiki.apache.org/ACTIVEMQ/enterprise-integration-patterns.html
> > >
> > > So you could just download tomorrows 5.0 snapshot and you're good to go...
> >
> > Thanks James! I've been building 5.0 from subversion anyway so I just
> > updated my local copy and I'll give this a shot.
>
> Great! Let us know how you get on & if there's anything we can do to
> make it easier to use Camel from inside the ActiveMQ broker

Perhaps I'm still a bit unclear on how to use this, I specified the
following config:

  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
    <route>
      <from uri="queue:a"/>
      <to uri="queue:b"/>
    </route>
  </camelContext>

Which as I understand it should take messages addressed to the queue
"a" and send them to "b". This doesn't seem to actually work though,
I've tried changing the endpoints from "queue:a" to "activemq:a" but
that didn't seem to help. Any tips for a newbie?

Another question I have is, how do I reload new definitions without
restarting? I've I'd like to change destinations or filtering how can
I do that on the fly and be sure I'm not dropping any messages?


Thanks,
Paul
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

jstrachan
On 7/5/07, Paul Dlug <[hidden email]> wrote:

> On 7/3/07, James Strachan <[hidden email]> wrote:
> > On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > > On 7/3/07, James Strachan <[hidden email]> wrote:
> > > > On 7/3/07, James Strachan <[hidden email]> wrote:
> > > > > On 7/3/07, Paul Dlug <[hidden email]> wrote:
> > > > > > Hopefully this is an easy answer. I'm a bit unclear on how Camel
> > > > > > should actually be used. I'm currently using ActiveMQ to do some basic
> > > > > > integration between applications in Java, Ruby, Perl, primarily via
> > > > > > STOMP. I'd like to use Camel to apply some of the enterprise
> > > > > > integration patterns, especially as it applies to routing as well as
> > > > > > using some of the built in connectors. From a quick read through the
> > > > > > docs it appears that I need to build Camel into an application itself
> > > > > > (in a servlet container or via spring). Is it possible to just run
> > > > > > Camel inside an ActiveMQ server to configure queues and handle routing
> > > > > > and other patterns?
> > > > >
> > > > > Absolutely! Actually its on my list of things to do to provide some
> > > > > examples of how to drop camel into the activemq.xml file.
> > > >
> > > > Actually it turned out to be way easier than I thought!
> > > >
> > > > http://cwiki.apache.org/ACTIVEMQ/enterprise-integration-patterns.html
> > > >
> > > > So you could just download tomorrows 5.0 snapshot and you're good to go...
> > >
> > > Thanks James! I've been building 5.0 from subversion anyway so I just
> > > updated my local copy and I'll give this a shot.
> >
> > Great! Let us know how you get on & if there's anything we can do to
> > make it easier to use Camel from inside the ActiveMQ broker
>
> Perhaps I'm still a bit unclear on how to use this, I specified the
> following config:
>
>   <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
>     <route>
>       <from uri="queue:a"/>
>       <to uri="queue:b"/>
>     </route>
>   </camelContext>
>
> Which as I understand it should take messages addressed to the queue
> "a" and send them to "b".

Unfortunately not; the "queue: " URI currently in Camel talks to an
in-memory queue. There's a note here

http://activemq.apache.org/camel/queue.html

I'm thinking to avoid further confusion we should rename this
component to be called "seda:" or something instead to avoid
confusion.


> This doesn't seem to actually work though,
> I've tried changing the endpoints from "queue:a" to "activemq:a" but
> that didn't seem to help. Any tips for a newbie?

So I just tried it with the latest trunk. I uncommented the route
thats in there & browsed the queue ("example.A) and it was created
with a single consumer. Though when I sent a message to it I got a
stack trace in the broker log with a ClassNotFoundException.

It turned out that the binary distro should be copying the JTA jar
from J2EE into the lib directory; but it wasn't. I've just fixed that,
so it seems to be working for me. Incidentally I've changed trunk to
enable the camel route by default to make it easier to try out

So these steps should work

* grab trunk & build it
* boot up the broker
* view the web console at http://0.0.0.0:8161/admin
* go to the queues tab
* you should now see an empty "example.A" queue
* try send some messages to this queue (there's a Send To link on the right)
* in a second or so hit refresh on the queues view; you should now see
the "example.B" queue with the message inside, with the example.A
queue now being empty




> Another question I have is, how do I reload new definitions without
> restarting? I've I'd like to change destinations or filtering how can
> I do that on the fly and be sure I'm not dropping any messages?

So rules defined in a Spring.xml file can be reloaded on change of the
XML file; if you want to redeploy your rules on the fly, you might
wanna boot up a separate spring application context with just the
rules inside (so that the broker isnt' redeployed too). e.g. create a
WAR or stand alone Java program with your rules so they can be
re-loaded on the fly without restarting your broker

--
James
-------
http://macstrac.blogspot.com/
Reply | Threaded
Open this post in threaded view
|

Re: Appropriate use case for Camel?

paul.dlug@gmail.com
> Unfortunately not; the "queue: " URI currently in Camel talks to an
> in-memory queue. There's a note here
>
> http://activemq.apache.org/camel/queue.html
>
> I'm thinking to avoid further confusion we should rename this
> component to be called "seda:" or something instead to avoid
> confusion.

Please add my vote for renaming this component, definitely a source of
confusion.

> > This doesn't seem to actually work though,
> > I've tried changing the endpoints from "queue:a" to "activemq:a" but
> > that didn't seem to help. Any tips for a newbie?
>
> So I just tried it with the latest trunk. I uncommented the route
> thats in there & browsed the queue ("example.A) and it was created
> with a single consumer. Though when I sent a message to it I got a
> stack trace in the broker log with a ClassNotFoundException.
>
> It turned out that the binary distro should be copying the JTA jar
> from J2EE into the lib directory; but it wasn't. I've just fixed that,
> so it seems to be working for me. Incidentally I've changed trunk to
> enable the camel route by default to make it easier to try out

Thanks, it's now working.

> > Another question I have is, how do I reload new definitions without
> > restarting? I've I'd like to change destinations or filtering how can
> > I do that on the fly and be sure I'm not dropping any messages?
>
> So rules defined in a Spring.xml file can be reloaded on change of the
> XML file; if you want to redeploy your rules on the fly, you might
> wanna boot up a separate spring application context with just the
> rules inside (so that the broker isnt' redeployed too). e.g. create a
> WAR or stand alone Java program with your rules so they can be
> re-loaded on the fly without restarting your broker

OK, so bear with me, it's been a while since I've done any serious
work with Spring (I'll go dust off the book later..). The separate
spring app context can live inside the broker and be restarted
independent of it? Or does it truly have to be separate?

Also, any plans to have a "proper DSL", something that would allow
patterns to be defined in something more readable than XML and less
heavy than java? ANTLR is really nice for creating these type of
grammars.


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

Re: Appropriate use case for Camel?

jstrachan
On 7/6/07, Paul Dlug <[hidden email]> wrote:

> > Unfortunately not; the "queue: " URI currently in Camel talks to an
> > in-memory queue. There's a note here
> >
> > http://activemq.apache.org/camel/queue.html
> >
> > I'm thinking to avoid further confusion we should rename this
> > component to be called "seda:" or something instead to avoid
> > confusion.
>
> Please add my vote for renaming this component, definitely a source of
> confusion.

JIRA here; lets do it :).
https://issues.apache.org/activemq/browse/CAMEL-70

We can then deprecate queue: until we remove it completely....


> > > This doesn't seem to actually work though,
> > > I've tried changing the endpoints from "queue:a" to "activemq:a" but
> > > that didn't seem to help. Any tips for a newbie?
> >
> > So I just tried it with the latest trunk. I uncommented the route
> > thats in there & browsed the queue ("example.A) and it was created
> > with a single consumer. Though when I sent a message to it I got a
> > stack trace in the broker log with a ClassNotFoundException.
> >
> > It turned out that the binary distro should be copying the JTA jar
> > from J2EE into the lib directory; but it wasn't. I've just fixed that,
> > so it seems to be working for me. Incidentally I've changed trunk to
> > enable the camel route by default to make it easier to try out
>
> Thanks, it's now working.

Great! :)


> > > Another question I have is, how do I reload new definitions without
> > > restarting? I've I'd like to change destinations or filtering how can
> > > I do that on the fly and be sure I'm not dropping any messages?
> >
> > So rules defined in a Spring.xml file can be reloaded on change of the
> > XML file; if you want to redeploy your rules on the fly, you might
> > wanna boot up a separate spring application context with just the
> > rules inside (so that the broker isnt' redeployed too). e.g. create a
> > WAR or stand alone Java program with your rules so they can be
> > re-loaded on the fly without restarting your broker
>
> OK, so bear with me, it's been a while since I've done any serious
> work with Spring (I'll go dust off the book later..). The separate
> spring app context can live inside the broker and be restarted
> independent of it? Or does it truly have to be separate?

I think it can be restarted separately; we should test it though :)
e.g. we might have to make a FactoryBean that boots up a separate
ApplicationContext just for the routings rules to make sure that the
broker's application context doesn't get reloaded, just the DSL one.
Off the top of my head I can't remember if there's a standard spring
way to kinda do an <include>, but for the included file to be a
separate child application context (which is reloaded separately).

I've created a JIRA to track this...
https://issues.apache.org/activemq/browse/AMQ-1317


> Also, any plans to have a "proper DSL", something that would allow
> patterns to be defined in something more readable than XML and less
> heavy than java? ANTLR is really nice for creating these type of
> grammars.

Yes, definitely! I'd like to see ruby and groovy versions too for power users.

FWIW I took some very basic steps here...
https://svn.apache.org/repos/asf/activemq/camel/ide/camel-eclipse/

the grammar is currently here
https://svn.apache.org/repos/asf/activemq/camel/ide/camel-eclipse/camel.routing/src/camel.xtxt

There's not yet much in the grammar yet :) as it was more an
experiment to test out the eclipse plugin stuff; as you can get a nice
eclipse plugin for editing the grammar pretty much for free! So yes
I'd really like a nice real DSL for Camel!

As a slight aside; I was going to experiment creating a simple POJO
model of the route definitions so that things could be defined easily
in JAXB2
https://issues.apache.org/activemq/browse/CAMEL-71

this POJO model should probably be used by the Antlr grammar. (Also
it'd be great if we could figure out the GMF ninja stuff to turn the
text based DSL editor into a graphical editor too!).

Anyone fancy volunteering to help create the Antlr file?

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