Embedded and hidden routing in Camel

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

Embedded and hidden routing in Camel

RoshanP
I want to define my routes and logic in Spring, and I believe I see how
to do this. Is it now possible to intercept all calls to a POJO and have
it run through the routes that I have specified for that POJO?

 

For example, I want to set up an EJB that calls a Spring injected POJO.
When the EJB calls the POJO, depending on the method called, Camel will
route the request to a particular JMS queue. From there, Camel will then
use routing rules set up for that queue to process and filter and send
the message to another POJO.

 

I feel like the only thing I am missing is abstracting the Camel routes
and logic so that I can just call the POJO directly and still have the
routes applied.

 

Roshan Punnoose

Phone: 301-497-6039

 

Reply | Threaded
Open this post in threaded view
|

Re: Embedded and hidden routing in Camel

jstrachan
On 8/2/07, Punnoose, Roshan <[hidden email]> wrote:
> I want to define my routes and logic in Spring, and I believe I see how
> to do this.

Great

> Is it now possible to intercept all calls to a POJO and have
> it run through the routes that I have specified for that POJO?

Do you mean using Camel routes as a proxy to some service (kinda like
Spring-Remoting)
http://activemq.apache.org/camel/bean-integration.html

you can do this using the CamelProxyFactoryBean
http://cwiki.apache.org/CAMEL/spring-remoting.html


Or do you mean you want to use Camel purely as an interceptor - called
before the bean is actually called to fire off some arbitrary messages
etc? Kinda like a POJO version of a wire tap


> For example, I want to set up an EJB that calls a Spring injected POJO.
> When the EJB calls the POJO, depending on the method called, Camel will
> route the request to a particular JMS queue. From there, Camel will then
> use routing rules set up for that queue to process and filter and send
> the message to another POJO.

Yeah - I think you just want to create a proxy to the POJO as
described above - this creates the client side stub which would send
the message to some endpoint/route. Then on the server side you'd
consume from some queue and route to the Spring POJO


> I feel like the only thing I am missing is abstracting the Camel routes
> and logic so that I can just call the POJO directly and still have the
> routes applied.

Yeah - right now you either use a client side proxy to fire a message
route; then on the server you consume messages and bind them to POJOs.

We could also add an interceptor which just sends a message to camel
before actually invoking a POJO method.

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

RE: Embedded and hidden routing in Camel

RoshanP
Yes, the spring remoting is the proper way of handling this I believe.
Do you have a quick example of using the Proxy and the ServiceExporter?
I'm having trouble setting it up.

Roshan Punnoose
Phone: 301-497-6039
-----Original Message-----
From: James Strachan [mailto:[hidden email]]
Sent: Friday, August 03, 2007 5:19 AM
To: [hidden email]
Subject: Re: Embedded and hidden routing in Camel

On 8/2/07, Punnoose, Roshan <[hidden email]> wrote:
> I want to define my routes and logic in Spring, and I believe I see
how
> to do this.

Great

> Is it now possible to intercept all calls to a POJO and have
> it run through the routes that I have specified for that POJO?

Do you mean using Camel routes as a proxy to some service (kinda like
Spring-Remoting)
http://activemq.apache.org/camel/bean-integration.html

you can do this using the CamelProxyFactoryBean
http://cwiki.apache.org/CAMEL/spring-remoting.html


Or do you mean you want to use Camel purely as an interceptor - called
before the bean is actually called to fire off some arbitrary messages
etc? Kinda like a POJO version of a wire tap


> For example, I want to set up an EJB that calls a Spring injected
POJO.
> When the EJB calls the POJO, depending on the method called, Camel
will
> route the request to a particular JMS queue. From there, Camel will
then
> use routing rules set up for that queue to process and filter and send
> the message to another POJO.

Yeah - I think you just want to create a proxy to the POJO as
described above - this creates the client side stub which would send
the message to some endpoint/route. Then on the server side you'd
consume from some queue and route to the Spring POJO


> I feel like the only thing I am missing is abstracting the Camel
routes
> and logic so that I can just call the POJO directly and still have the
> routes applied.

Yeah - right now you either use a client side proxy to fire a message
route; then on the server you consume messages and bind them to POJOs.

We could also add an interceptor which just sends a message to camel
before actually invoking a POJO method.

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

Re: Embedded and hidden routing in Camel

jstrachan
On 8/3/07, Punnoose, Roshan <[hidden email]> wrote:
> Yes, the spring remoting is the proper way of handling this I believe.
> Do you have a quick example of using the Proxy and the ServiceExporter?
> I'm having trouble setting it up.

If you are using trunk - there's are 3 test cases here...
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/

I've also finally updated the documentation with examples...
http://cwiki.apache.org/CAMEL/spring-remoting.html

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

Re: Embedded and hidden routing in Camel

Hiram Chirino
Hey.. nice work James!

I think the examples would read cleaner if the

<camel:proxyFactory .. was changed to <camel:proxy ..
and <camel:serviceExporter.. was chagned to <camel:export ...

I'd like to change these if you don't mind.

Regards,
Hiram

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

> On 8/3/07, Punnoose, Roshan <[hidden email]> wrote:
> > Yes, the spring remoting is the proper way of handling this I believe.
> > Do you have a quick example of using the Proxy and the ServiceExporter?
> > I'm having trouble setting it up.
>
> If you are using trunk - there's are 3 test cases here...
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/remoting/
>
> I've also finally updated the documentation with examples...
> http://cwiki.apache.org/CAMEL/spring-remoting.html
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>


--
Regards,
Hiram

Blog: http://hiramchirino.com
Reply | Threaded
Open this post in threaded view
|

Re: Embedded and hidden routing in Camel

jstrachan
On 8/4/07, Hiram Chirino <[hidden email]> wrote:
> Hey.. nice work James!
>
> I think the examples would read cleaner if the
>
> <camel:proxyFactory .. was changed to <camel:proxy ..
> and <camel:serviceExporter.. was chagned to <camel:export ...
>
> I'd like to change these if you don't mind.

Go for it!

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