Hi.  

I was inspired by 
http://goldentoolbox.blogspot.com/2007/07/good-frameworks.html this blog
post  to learn more about camel, and ultimately I implemented a clustered
Component.

Essentially, I wrote a Component which creates endpoints that can be
accessed across VMs - something like the VM Component, except the Queues
that are created are clustered via  http://www.terracotta.org Terracotta 
clustering.

Example code looks like:

Main:
    public static void main(String[] args) throws Exception
    {
        CamelContext context = new DefaultCamelContext();
  
        CamelTemplate template = new CamelTemplate(context);
        context.start();
        for(int i=0;i<10;i++) {
            template.sendBody("tc:input","Test Message: "+i);
        }
        Thread.sleep(1000);
        context.stop();
    }

Main2:
    public static void main(String[] args) throws Exception
    {
        CamelContext context = new DefaultCamelContext();
        
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("tc:input").process(new Processor() {
                    public void process(Exchange e) {
                        System.out.println("tc:input " +
e.getIn().getBody());
                    }
                });
            }
        });

        System.out.println("Starting camel context");
        context.start();
        Thread.currentThread().join();
    }

And the output running Main2 and then Main looks like:

Starting camel context
tc:input Test Message: 0
tc:input Test Message: 1
tc:input Test Message: 2
tc:input Test Message: 3
tc:input Test Message: 4
tc:input Test Message: 5
tc:input Test Message: 6
tc:input Test Message: 7
tc:input Test Message: 8
tc:input Test Message: 9

If you think this is interesting let me know and I can work out making the
project available for broader consumption (it's a very early POC, so it's
not really ready for public consumption as I only spent an hour or two
figuring out camel)

Taylor
-- 
View this message in context: 
http://www.nabble.com/Terracotta-clustered-Camel-tf4210811s22882.html#a11978029
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to