2010年12月19日 星期日

What's difference between VM and SEDA?

VM and SEDA endpoints are basically the same; they both offer asychronous in memory SEDA queues; they differ in visibility endpoints are visible inside the same JVM or within the same CamelContext respectively.

First kind of asynchronous endpoint (SEDA)

from(“seda:start”).beanRef(“someBean”, “someMethod”);

Exchanges (messages) put to the seda:start endpoint will be processed through the remainder of the Camel route. The SEDA endpoint encapsulates an in-memory queue used as an entry point to the route. All messages are processed asynchronously. In the example above, the messages would be routed to the someMethod method on a spring bean named someBean.

Camel Terminologies

A component is to be a factory and manager of Endpoints.


The Injector is a pluggable strategy to any IoC container such as Spring or Guice to be able to create and dependency-inject objects of a certain type.


HawtDB is a very lightweight and embedable key value database. It allows together with Camel to provide persistent support for various Camel features such as Aggregator.


Apache Camel’s SEDA (Staged Event-Driven Architecture) endpoints (http://camel.apache.org/seda.html) provide a useful and quick mechanism to implement asynchronous, event-driven processing within your applications. See http://www.eecs.harvard.edu/~mdw/proj/seda/ for the original description of the SEDA architecture.

Input

-- ask user to enter a number --

<<
from uri="stream:in?promptMessage=Enter a number to be added (use STOP to end, and ctrl+c to shutdown Camel): &promptDelay=1000"
//>>

2010年12月17日 星期五

send message to my gtalk

quoted from

http://www.andrejkoelewijn.com/wp/2009/02/28/groovy-and-grape-easiest-way-to-send-gtalk-message-with-apache-camel/

INSTALL GROOVY AND add $HOME/.groovy/grapeConfig.xml file first. (get grapeConfig.xml from above URL)


#!/usr/local/groovy-1.6.0/bin/groovy

import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.language.groovy.GroovyRouteBuilder;

@Grab(group='org.apache.camel', module='camel-groovy', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-xmpp', version='1.6.0')
@Grab(group='org.apache.camel', module='camel-core', version='1.6.0')
class SampleRoute extends GroovyRouteBuilder {
protected void configure(){
from("file:///tmp/jabber").
to("xmpp://talk.google.com:5222/mingderwang@gmail.com?serviceName=gmail.com&user=yourname&password=secrect");
}
}

def camelCtx = new DefaultCamelContext()
camelCtx.addRoutes(new SampleRoute());
camelCtx.start();

A composite Rest service using Apache Camel (by Andrej Koelewijn)




http://www.andrejkoelewijn.com/wp/2010/06/13/a-composite-rest-service-using-camel/