Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Camel Module for Play! Framework

About this module

This module aim at integrating EIP pattern into the Play! Framework.

Components of this module

Installing module

  • Using conf/dependencies.yaml and adding a dependency:
play -> camel [version]
  • Using conf/application.conf and adding a module:

Getting dependencies

You need to make sure you are able to retreive all dependencies for this module, or it won’t work.

play deps --sync


Not much to configure, all required settings have defaults values.

List of properties user can override

Key Default Description Required
broker.connector none (ex.: tcp://localhost:61616) host:port that will be exposed by the ActiveMQ Connector Optional
broker.url vm:localhost URL used for instanciating an embedded broker Optional
camel.hazelcast none whether to start Hazelcast as component or not (default: not) Optional

Using @Inject

You can inject CamelContext into any class by using JSR-330:

private static CamelContext context

A good place is in a Bootstrap class, a class that extends Job and has the OnApplicationStart annotation:

public class Bootstrap extends Job {

Making your first Route

In the previous class in which you injected CamelContext, you can then use the Camel DSL which support:

  • Java
  • Scala

RouteBuilder : Where it all begin…

I recommend you to read the architecture documentation if you need more than this basic example.

Here is a sample route you can test easily:

// Prepare the route
RouteBuilder routes = new RouteBuilder() {
	public void configure() throws Exception {
		from("file:///Users/marcus/tmp/INBOX").id("myInbox").log("Sending to JMS").to("activemq:testQueue");
		from("activemq:testQueue").id("myFakeEMail").log("Sending Email").to("log:myLogCategory?level=INFO&showBody=true");

The 1st route simply check for files in my INBOX directory, and then send the content to the testQueue JMS queue. The 2nd route listen for incoming messages, then send the content to a log category. The to part could have been a ftp, a smtp, or a bean (a processor in Camel terms…)

After the routes are created, you can then deploy them using the RouteBuilder class you created directly in CamelContext:

// Add them to camel-context


You now have a fully fonctionning EIP + an embedded JMS Broker right on your Play! application.

Have fun ;-), Marc


A EIP + Messaging module for the Play! Framework



No packages published