Interesting discussion :)

On 11/10/2007, James Strachan <[EMAIL PROTECTED]> wrote:
> On 11/10/2007, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
> > Bringing this thread to dev list
> >
> > On 10/11/07, James Strachan <[EMAIL PROTECTED]> wrote:
> > > > We need to find a way to discover other ServiceMix instances (through
> > > > ActiveMQ ? any other idea ?)

[big snip]

> > > From a low level I was wondering about a Camel factory bean in spring
> > >
> > > <camel:heartbeat bean="someBeanRef" property="myStatusEventObject"
> > > millis="2000" uri="http://someServer.com/cheese"/>
> > >
> > > This would call someBeanRef.getMyStatusEventObject() every 2 seconds
> > > and send the POJO to the endpoint URI. We could maybe wrap up this
> > > using some route? e.g. if the bean endpoint allowed for polling we
> > > could maybe do
> > >
> > > from("bean:someBeanRef?method=getMyStatusEventObject&period=2000").to("http://someServer.com/cheese";)
> > >
> > > though maybe a factory bean (XML element) is a bit easier - it does
> > > have better smart completion at least :)
> > >
> >
> > I like the idea of using camel to configure the discovery mechanism.
> > This would be very flexible.
>
> Yeah; am thinking we could do content based routing or message
> translator stuff to format the POJO of the heartbeat data into
> different formats, sending it to different locations etc

As an experiment in implementing a POJO based heartbeat mechanism
thats protocol and data format independent (and can support the easy
integration of EIP) I thought I'd try write a little test case in
Camel.

It turned out to be surprisingly easy :)

from("bean:myService?methodName=status").to("mock:result");

where the status() method is invoked periodically on the myService
bean and then sent to the registry endpoint (a mock in this case as
its a test case, but this could be activemq:topic:foo.bar etc)

Here's the test case if you're interested...
https://svn.apache.org/repos/asf/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/BeanMethodHeartbeatTest.java

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

Open Source SOA
http://open.iona.com

Reply via email to