Routes DSL

The Routes service can be used as a replacement for the following b2box5 legacy features:

  • Routing rules
  • Scheduler adapter
  • File system monitor
  • Custom receive servlets

The custom Platform 6 components built to integrate with the Apache Camel router architecture provide a powerful and feature-rich service.

Route deployment scripts and templates

The Routes are defined using a Groovy-based DSL. The user interface allows the selection of named event templates to reduce the quantity of boiler plate code required to define a route.

Templates are stored in:

  • ${B2BOX_DATA}/resources/templates
  • ${B2BOX_HOME}/resources/templates

and have the .groovy file extension.

The FreeMarker template engine is used for simple token markup allowing the development of custom templates.

The binding available for routes scripts are:


Although routes are defined using Groovy, the full Platform 6 DSL bindings are not available during route definition. It is recommended that the P6Cmb component or service DSL is used to call a script to gain full access to the Platform 6 DSL methods.


Camel has a library of hundreds of useful components:

The following components are Platform 6 specific or recommended replacements for older Amalto integration components.

Pre-installed components:

Platform 6 specific components:

Other components used less frequently by Platform 6 projects can be found here:

Components are referred to using a URL syntax within a route definition:

<componentid>://<component specifc args>

Camel Route Structure

A camel route typically starts with a from() or rest() statement to define the origin for a trigger event.

A to() statement is used to denote the route destination.

A routId() (or id()when using route()) is used to name your route in memory. It must be unique. Any attempt to create a route that already exists will generate an error. If you fail to name your routes, camel will name them for you as routeN, where N is a unique number.

A description() statement allows you to add a more verbose description about the intention of the route. This will be displayed in the active routes list of the UI.

    .description("My Route description in here")


Groovy bean execution

Using template: BaseRouteWithBean.groovy

This demonstrates how additional groovy bean(s) code can be executed.

${addBeanAndRegister} :=

class ServiceBean {
    def void run() {
        println("Hello World!")

camel.registerBean("myBean", ServiceBean )

${addRoutes} :=


${destroyRoutes} :=


Rename files to process with bean

Using template: BaseRouteWithBean.groovy

Combines the File2 and the bean components to show how filenames can be manipulated during a route.

${addBeanAndRegister} :=

class UpperCaseTextService {
    def String transform(String text) {
        return text.toUpperCase()

camel.registerBean("upperCaseTextService", UpperCaseTextService )

def dataDir = "${B2BOX_DATA}/test/demo"

${addRoutes} :=


${destroyRoutes} :=


Perform WEB3_SHA request using P6Web3j

P6web3j is a Producer as well as a Consumer component and as such, you can use it to call any number of Web3 RPC methods:

def exchange = [ body: "0x68656c6c6f20776f726c64" ]

def exMap = camel.endpointExchangeWaitInput("p6web3j://", exchange)



It may be better for the user the ethereumrpc DSL binding in Platform 6 scripts for more complex web3 RPC interactions.