Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can append query options to the URI in the following format, ?option=value&option=value&...

Example

In this example we'll create a black box context, then we'll use it from another CamelContext.

Defining the black box context

First you need to create a CamelContext, add some routes in it, start it and then register the CamelContext into the Registry (JNDI, Spring, Guice or OSGi etc).

...

Code Block
xml
xml
<camelContext id="accounts" xmlns="http://camel.apache.org/schema/spring">
  <route> 
    <from uri="direct:purchaseOrder"/>
    ...
    <to uri="direct:invoice"/>
  </route>
</camelContext>

Using the black box context

Then in another CamelContext we can then refer to this "accounts black box" by just sending to accounts:purchaseOrder and consuming from accounts:invoice.

...

Code Block
xml
xml
<camelContext id="bindAccountsToActiveMQ" xmlns="http://camel.apache.org/schema/spring">
  <route> 
    <!-- Sendconsume messagesfrom onan ActiveMQ into the purchase order black box -->
    <from uri="activemq:Accounts.PurchaseOrders"/>
    <to uri="accounts:purchaseOrders"/>
  </route>
  <route> 
    <!-- lets send accounts invoices from the black box to a andifferent ActiveMQ Queue -->
    <from uri="accounts:invoice"/>
    <to uri="activemq:UK.Accounts.Invoices"/>
  </route>
</camelContext>