You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christoph Burmeister <ch...@googlemail.com> on 2011/04/11 10:48:27 UTC

communication between camel-instances

Hi,

I'm pretty new to Apache Camel, and I want to figure out, if I can use
it for our application.

Following case: two Camel-instances, running on different physical
servers. Both will receive the same messages from
3rd-party-application (which is configured to send to the two
ip-adresses). If the first Camel is up and running the second Camel
should ignore the incoming message, otherwise the second Camel should
process it.
So far the situation. I know there is a possible solution by using a
load-balancer and then route the message via fail-over-strategy to the
instances. But in case of a broken load-balancer, I have just two
useless Camel-instances.

My solution would be a kind of "Hello"-Message, which is sent from the
second Camel to the first Camel (with ack), to make sure, that the
first is still living. Main-target is to receive all(!) messages and
process them.

Do you have any ideas how to realize this or do you have another
solution regarding my needs? Thanks in advance,

best,
Christoph

Re: communication between camel-instances

Posted by Christoph Burmeister <ch...@googlemail.com>.
OK, I found a bit of time to get along with this problem. I tried to
create a kind of "heartbeat-bean" but finally my solution is, that
everytime the second camel gets a message from 3rd-party-application,
the message is routed through a load-balancer with failover-option,
while on the first camel I started a simple-jetty-endpoint (playing
ping-pong). This is my configuration:

<camel:loadBalance>
       <camel:failover maximumFailoverAttempts="5" roundRobin="false" />
       <!-- try to reach first camel, if got an exception, go on with
self-processing! -->
       <camel:to uri="http://x.y.z.a:12345" />
       <camel:to uri="activemq:queue:incomingSnmpTraps" />
</camel:loadBalance>

So the second camel tries 5 times to reach the first, before it
processes the message on his own.
Hazelcast is not needed at the moment, but especially in combination
with multiple instances of camel it sounds very interesting and we'll
have a look at it for the future.

Christoph

Re: communication between camel-instances

Posted by Claus Straube <cl...@catify.com>.
Hi Christoph,

you can definitely use the Hazelcast component very easily to figure out 
if a instance comes up or goes down by using "fromF("hazelcast:%sfoo", 
HazelcastConstants.INSTANCE_PREFIX)". This is more an event based 
approach than polling constantly for an instance.

Best regards - Claus

On 11.04.2011 15:33, Christoph Burmeister wrote:
> Hi Claus, hi Ashwin,
>
> thanks for your fast replies. I'll give the Quartz-triggered
> heartbeat-bean a try and will report back. Solution with ServiceMix
> sounds also good, but these camel-apps have to run in standalone-mode
> with little overhead. I don't know hazlcast (yet) but will have a look
> at it.
>
> BTW maybe for later releases, a standard-camel-component called
> "camel-heartbeat" would be usefull, no? :-)
>
> best,
> Christoph
>


Re: communication between camel-instances

Posted by Christoph Burmeister <ch...@googlemail.com>.
Hi Claus, hi Ashwin,

thanks for your fast replies. I'll give the Quartz-triggered
heartbeat-bean a try and will report back. Solution with ServiceMix
sounds also good, but these camel-apps have to run in standalone-mode
with little overhead. I don't know hazlcast (yet) but will have a look
at it.

BTW maybe for later releases, a standard-camel-component called
"camel-heartbeat" would be usefull, no? :-)

best,
Christoph

Re: communication between camel-instances

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

We have debated this before on this mailing list, so you would maybe
be able with a bit luck to google those threads.

If you use Apache ServiceMix to host your Camel applications then it
offers clustering capabilities, using its NMR, JBI or JMS transports.
You can also consider embedding AMQ and use JMS.

There is a clustering guide at FuseSource
http://fusesource.com/products/enterprise-activemq/#documentation

There is also hazelcast and other similar for in-memory grids. We
recently added Camel integration for that:
http://camel.apache.org/hazelcast-component.html



On Mon, Apr 11, 2011 at 10:48 AM, Christoph Burmeister
<ch...@googlemail.com> wrote:
> Hi,
>
> I'm pretty new to Apache Camel, and I want to figure out, if I can use
> it for our application.
>
> Following case: two Camel-instances, running on different physical
> servers. Both will receive the same messages from
> 3rd-party-application (which is configured to send to the two
> ip-adresses). If the first Camel is up and running the second Camel
> should ignore the incoming message, otherwise the second Camel should
> process it.
> So far the situation. I know there is a possible solution by using a
> load-balancer and then route the message via fail-over-strategy to the
> instances. But in case of a broken load-balancer, I have just two
> useless Camel-instances.
>
> My solution would be a kind of "Hello"-Message, which is sent from the
> second Camel to the first Camel (with ack), to make sure, that the
> first is still living. Main-target is to receive all(!) messages and
> process them.
>
> Do you have any ideas how to realize this or do you have another
> solution regarding my needs? Thanks in advance,
>
> best,
> Christoph
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: communication between camel-instances

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

You could create a heartbeat bean that pings back any request sent by quartz
routes created in another context. This will let you know if the other
context is up and take the appropriate action.

You will have to ensure that the quartz route sends an in-out exchange to
the heartbean bean listening in another context.

Cheers,

Ashwin...

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

Blog: http://opensourceknowledge.blogspot.com 
CamelOne 2011: http://fusesource.com/camel2011 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/communication-between-camel-instances-tp4295464p4295779.html
Sent from the Camel - Users mailing list archive at Nabble.com.