#143 Work on the example code

This commit is contained in:
Ilkka Seppala 2015-08-22 16:37:19 +03:00
parent cd4d420376
commit acd7070831
3 changed files with 23 additions and 1 deletions

View File

@ -14,6 +14,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -1,14 +1,27 @@
package com.iluwatar.message.channel;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class App {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:greetings").to("stream:out");
}
});
context.start();
Thread.sleep(10000);
ProducerTemplate template = context.createProducerTemplate();
template.sendBody("direct:greetings", "jou man");
Thread.sleep(1000);
context.stop();
}
}

View File

@ -111,6 +111,11 @@
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>