From commits-return-66017-archive-asf-public=cust-asf.ponee.io@camel.apache.org Wed Oct 17 11:28:16 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C39F1180679 for ; Wed, 17 Oct 2018 11:28:14 +0200 (CEST) Received: (qmail 81201 invoked by uid 500); 17 Oct 2018 09:28:13 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 81184 invoked by uid 99); 17 Oct 2018 09:28:13 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2018 09:28:13 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id B67753A1592 for ; Wed, 17 Oct 2018 09:28:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1036341 [5/17] - in /websites/production/camel/content: ./ 2015/10/14/ 2018/10/ 2018/10/17/ cache/ Date: Wed, 17 Oct 2018 09:28:10 -0000 To: commits@camel.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20181017092812.B67753A1592@svn01-us-west.apache.org> Modified: websites/production/camel/content/book-in-one-page.html ============================================================================== --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Wed Oct 17 09:28:08 2018 @@ -91,11 +91,11 @@ -

Apache Camel

User Guide

Version 2.15.0

+

Apache Camel

User Guide

Version 2.15.0


Copyright 2007-2016, Apache Software Foundation

-
+

Table of Contents

@@ -103,20 +103,20 @@

-
+

Introduction

-
Apache Camel ™ is a versatile open-source integration framework based on known Enterprise Integration Patterns.

Camel empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL. This means you get smart completion of routing rules in your IDE, whether in a Java, Scala or XML editor.

Apache Camel uses URIs to work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF, as well as pluggable Components and Data Format options. Apache Camel is a small library with minimal dependencies for easy embedding in any Java application. Apache Camel lets you work with the same API regardless which kind of Transport is used - so learn the API once and you can interact with all the Components provided out-of-box.

Apache Camel provides support for Bean Binding and seamless integration with popular fr ameworks such as CDISpring, Blueprint and Guice. Camel also has extensive support for unit testing your routes.

The following projects can leverage Apache Camel as a routing and mediation engine:

  • Apache ServiceMix - a popular distributed open source ESB and JBI container
  • Apache ActiveMQ - a mature, widely used open source message broker
  • Apache CXF - a smart web services suite (JAX-WS and JAX-RS)
  • Apache Karaf - a small OSGi based runtime in which ap plications can be deployed
  • Apache MINA - a high-performance NIO-driven networking framework

So don't get the hump - try Camel today! (smile)

Too many buzzwords - what exactly is Camel?

Okay, so the description above is technology focused.
There's a great discussion ab out Camel at Stack Overflow. We suggest you view the post, read the comments, and browse the suggested links for more details.

+Apache Camel ™ is a versatile open-source integration framework based on known Enterprise Integration Patterns.

Camel empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL. This means you get smart completion of routing rules in your IDE, whether in a Java, Scala or XML editor.

Apache Camel uses URIs to work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF, as well as pluggable Components and Data Format options. Apache Camel is a small library with minimal dependencies for easy embedding in any Java application. Apache Camel lets you work with the same API regardless which kind of Transport is used - so learn the API once and you can interact with all the Components provided out-of-box.

Apache Camel provides support for Bean Binding and seamless integration with popular frameworks such as CDISpring, Blueprint and Guice. Camel also has extensive support for unit testing your routes.

The following projects can leverage Apache Camel as a routing and mediation engine:

  • Apache ServiceMix - a popular distributed open source ESB and JBI container
  • Apache ActiveMQ - a mature, widely used open source message broker
  • Apache CXF - a smart web services suite (JAX-WS and JAX-RS)
  • Apache Karaf - a small OSGi based runtime in which applications can be deployed
  • Apache MINA - a high-performance NIO-driven networking framework

So don't get the hump - try Camel today! (smile)

Too many buzzwords - what exactly is Camel?

Okay, so the description above is technology focused.
There's a great discussion about Camel at Stack Overflow. We suggest you view the post, read the comments, and browse the suggested links for more details.

-
+

Quickstart

To start using Apache Camel quickly, you can read through some simple examples in this chapter. For readers who would like a more thorough introduction, please skip ahead to Chapter 3.

-

Walk through an Example Code

This mini-guide takes you through the source code of a simple example.

Camel can be configured either by using Spring or directly in Java - which this example does.

This example is available in the examples\camel-example-jms-file directory of the Camel distribution.

We start with creating a CamelContext - which is a container for Components, Routes etc:{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}There is more than one way of adding a Component to the CamelContext. You can add components implicitly - when we set up the routing - as we do here for the FileComponent:{snippet:id=e3|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}or explicitly - as we do here when we add the JMS Component:{snippet:id=e2|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}The abov e works with any JMS provider. If we know we are using ActiveMQ we can use an even simpler form using the activeMQComponent() method while specifying the brokerURL used to connect to ActiveMQ

In normal use, an external system would be firing messages or events directly into Camel through one if its Components but we are going to use the ProducerTemplate which is a really easy way for testing your configuration:{sni ppet:id=e4|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}Next you must start the camel context. If you are using Spring to configure the camel context this is automatically done for you; though if you are using a pure Java approach then you just need to call the start() method

camelContext.start(); -

This will start all of the configured routing rules.

So after starting the CamelContext, we can fire some objects into camel:{snippet:id=e5|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}

What happens?

From the ProducerTemplate - we send objects (in this case text) into the CamelContext to the Component test-jms:queue:test.queue. These text objects will be converted automatically into JMS Messages and posted to a JMS Queue named test.queue. When we set up the Rou te, we configured the FileComponent to listen off the test.queue.

The File FileComponent will take messages off the Queue, and save them to a directory named test. Every message will be saved in a file that corresponds to its destination and message id.

Finally, we configured our own listener in the Route - to take notifications from the FileComponent and print them out as text.

That's it!

If you have the time then use 5 more minutes to Walk through another example that demonstrates the Spring DSL (XML based) routing.

-

Walk through another example

+

Walk through an Example Code

This mini-guide takes you through the source code of a simple example.

Camel can be configured either by using Spring or directly in Java - which this example does.

This example is available in the examples\camel-example-jms-file directory of the Camel distribution.

We start with creating a CamelContext - which is a container for Components, Routes etc:{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}There is more than one way of adding a Component to the CamelContext. You can add components implicitly - when we set up the routing - as we do here for the FileComponent:{snippet:id=e3|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}or explicitly - as we do here when we add the JMS Component:{snippet:id=e2|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}The above works with any JMS provider. If we know we are using ActiveMQ we can use an even simpler form using the activeMQComponent() method while specifying the brokerURL used to connect to ActiveMQ

In normal use, an external system would be firing messages or events directly into Camel through one if its Components but we are going to use the ProducerTemplate which is a really easy way for testing your configuration:{snippet:id=e4|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/o rg/apache/camel/example/jmstofile/CamelJmsToFileExample.java}Next you must start the camel context. If you are using Spring to configure the camel context this is automatically done for you; though if you are using a pure Java approach then you just need to call the start() method

camelContext.start(); +

This will start all of the configured routing rules.

So after starting the CamelContext, we can fire some objects into camel:{snippet:id=e5|lang=java|url=camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java}

What happens?

From the ProducerTemplate - we send objects (in this case text) into the CamelContext to the Component test-jms:queue:test.queue. These text objects will be converted automatically into JMS Messages and posted to a JMS Queue named test.queue. When we set up the Rou te, we configured the FileComponent to listen off the test.queue.

The File FileComponent will take messages off the Queue, and save them to a directory named test. Every message will be saved in a file that corresponds to its destination and message id.

Finally, we configured our own listener in the Route - to take notifications from the FileComponent and print them out as text.

That's it!

If you have the time then use 5 more minutes to Walk through another example that demonstrates the Spring DSL (XML based) routing.

+

Walk through another example

Introduction

Continuing the walk from our first example, we take a closer look at the routing and explain a few pointers - so you won't walk into a bear trap, but can enjoy an after-hours walk to the local pub for a large beer (wink)

@@ -245,10 +245,10 @@

This example is also based on the in-only message exchange pattern. What you must understand as well is the in-out message exchange pattern, where the caller expects a response. We will look into this in another example.

See also

-
+
-
+

Getting Started with Apache Camel

@@ -414,8 +414,8 @@ However, there is another option that th

Continue Learning about Camel

-

Return to the main Getting Started page for additional introductory reference information.

-
+

Return to the main Getting Started page for additional introductory reference information.

+

Architecture

Camel uses a Java based Routing Domain Specific Language (DSL) or an Xml Configuration to configure routing and mediation rules which are added to a CamelContext to implement the various Enterprise Integration Patterns. @@ -426,11 +426,11 @@ However, there is another option that th

The DSL makes heavy use of pluggable Languages to create an Expression or Predicate to make a truly powerful DSL which is extensible to the most suitable language depending on your needs. The following languages are supported

- +

Most of these languages is also supported used as Annotation Based Expression Language.

For a full details of the individual languages see the Language Appendix

-

URIs

+

URIs

Camel makes extensive use of URIs to allow you to refer to endpoints which are lazily created by a Component if you refer to them within Routes.

@@ -439,7 +439,7 @@ However, there is another option that th

Current Supported URIs

-

Component / ArtifactId / URI

Description

AHCcamel-ahc

+

Component / ArtifactId / URI

Description

AHCcamel-ahc

ahc:http[s]://hostName[:port][/resourceUri][?options]
 

To call external HTTP services using Async Http Client

AHC-WS camel-ahc-ws

@@ -1036,14 +1036,14 @@ flink:datastream[?options]

Allows you to interact with the Yammer enterprise social network

Zookeepercamel-zookeeper

zookeeper://zookeeperServer[:port][/path][?options]
 
-

Working with ZooKeeper cluster(s)

 





+

Working with ZooKeeper cluster(s)

 





URI's for external components

Other projects and companies have also created Camel components to integrate additional functionality into Camel. These components may be provided under licenses that are not compatible with the Apache License, use libraries that are not compatible, etc... These components are not supported by the Camel team, but we provide links here to help users find the additional functionality.

-

Component / ArtifactId / URI

License

Description

ActiveMQactivemq-camel

+

Component / ArtifactId / URI

License

Description

ActiveMQactivemq-camel

activemq:[queue|topic:]destinationName

Apache

For JMS Messaging with Apache ActiveMQ.

ActiveMQ Brokeractivemq-camel

broker:[queue|topic:]destinationName
@@ -1124,12 +1124,12 @@ flink:datastream[?options]

Apache

Camel Webcam component can be used to capture still images and detect motion.

ZeroMQcamel-zeromq / camel-extra

zeromq:(tcp|ipc)://hostname:port
 
-

LGPL

The ZeroMQ component allows you to consumer or produce messages using ZeroMQ.

+

LGPL

The ZeroMQ component allows you to consumer or produce messages using ZeroMQ.

For a full details of the individual components see the Component Appendix

-
+

Enterprise Integration Patterns

@@ -1145,19 +1145,19 @@ flink:datastream[?options]
-
+

CookBook

This document describes various recipes for working with Camel -
+

Annotation Based Expression Language

You can also use any of the Languages supported in Camel to bind expressions to method parameters when using Bean Integration. For example you can use any of these annotations:

@@ -1274,8 +1274,8 @@ public class MySimpleIdGenerator {
-

Groovy supports GStrings that is like a template where we can insert $ placeholders that will be evaluated by Groovy.

-

Bean Binding

Bean Binding in Camel defines both which methods are invoked and also how the Message is converted into the parameters of the method when it is invoked.

Choosing the method to invoke

The binding of a Camel Message to a bean method call can occur in different ways, in the following order of importance:

  • if the message contains the header CamelBeanMethodName then that method is invoked, converting the body to the type of the method's argument.
    • From Camel 2.8 onwards you can qualify parameter types to select exactly which method to use among overloads with the same name (see below for more details).
    • From Camel 2.9 onwards you can specify parameter values directly in the method option (see below for more details).
  • you can explicitly specify the method name in the DSL or when using POJO Consuming or POJO Producing
  • if the bean has a method marked with the @Handler annotation, then that method is selected
  • if the bean can be converted to a Processor using the Type Converter mechanism, then this is used to process the message. The ActiveMQ component uses this mechanism to allow any JMS MessageListener to be invoked directly by Camel without having to write any integration glue code. You can use the same mechanism to integrate Camel into any other messaging/remoting frameworks.
  • if the body of the message can be co nverted to a BeanInvocation (the default payload used by the ProxyHelper) component - then that is used to invoke the method and pass its arguments
  • otherwise the type of the body is used to find a matching method; an error is thrown if a single method cannot be chosen unambiguously.
  • you can also use Exchange as the parameter itself, but then the return type must be void.
  • if the bean class is private (or package-private), interface methods will be preferred (from Camel 2.9 onwards) since Camel can't invoke class methods on such beans

In cases where Camel cannot choose a method to invoke, an AmbiguousMethodCallException is thrown.

By default the return value is set on the outbound message body. 

Asynchronous processing

From Camel 2.18 onwards you can return a CompletionStage implementation (e.g. a CompletableFuture) to implement asynchronous processing.

Please be sure to properly complete the CompletionStage with the result or exception, including any timeout handling. Exchange processing would wait for completion and would not impose any timeouts automatically. It's extremely useful to monitor Inflight repository for any hanging messages.

Note that completing with "null" won't set outbody message body to null, but would keep message intact. This is useful to support methods that don't modify exchange and return CompletableFuture< ;Void>. To set body to null, just add Exchange method parameter and directly modify exchange messages.

Examples:

Simple asynchronous processor, modifying message body.

+

Groovy supports GStrings that is like a template where we can insert $ placeholders that will be evaluated by Groovy.

+

Bean Binding

Bean Binding in Camel defines both which methods are invoked and also how the Message is converted into the parameters of the method when it is invoked.

Choosing the method to invoke

The binding of a Camel Message to a bean method call can occur in different ways, in the following order of importance:

  • if the message contains the header CamelBeanMethodName then that method is invoked, converting the body to the type of the method's argument.
    • From Camel 2.8 onwards you can qualify parameter types to select exactly which method to use among overloads with the same name (see below for more details).
    • From Camel 2.9 onwards you can specify parameter values directly in the method option (see below for more details).
    • you can explicitly specify the method name in the DSL or when using POJO Consuming or POJO Producing
    • if the bean has a method marked with the @Handler annotation, then that method is selected
    • if the bean can be converted to a Processor using the Type Converter mechanism, then this is used to process the message. The ActiveMQ component uses this mechanism to allow any JMS MessageListener to be invoked directly by Camel without having to write any integration glue code. You can use the same mechanism to integrate Camel into any other messaging/remoting frameworks.
    • if the body of the message can be converted to a BeanInvocation (the default payload used by the ProxyHelper) component - then that is used to invoke the method and pass its arguments
    • otherwise the type of the body is used to find a matching method; an error is thrown if a single method cannot be chosen unambiguously.
    • you can also use Exchange as the parameter itself, but then the return type must be void.
    • if the bean class is private (or package-private), interface methods will be preferred (from Camel 2.9 onwards) since Camel can't invoke class methods on such beans

    In cases where Camel cannot choose a method to invoke, an AmbiguousMethodCallException is thrown.

    By default the return value is set on the outbound message body. 

    Asynchronous processing

    From Camel 2.18 onwards you can return a CompletionStage implementation (e.g. a CompletableFuture) to implement asynchronous processing.

    Please be sure to properly complete the CompletionStage with the result or exception, including any timeout handling. Exchange processing would wait for completion and would not impose any timeouts automatically. It's extremely useful to monitor Inflight repository for any hanging messages.

    Note that completing with "null" won't set outbody message body to null, but would keep message intact. This is useful to support methods that don't modify exchange and return CompletableFuture<Void>. To set body to null, just add Exchange method parameter and directly modi fy exchange messages.

    Examples:

    Simple asynchronous processor, modifying message body.

    public CompletableFuture<String> doSomethingAsync(String body)


    Composite processor that do not modify exchange

     public CompletableFuture<Void> doSomethingAsync(String body) {
    @@ -1349,8 +1349,8 @@ public class MySimpleIdGenerator {
     
    .bean(OrderService.class, "doSomething(com.foo.MyOrder)")


    Camel currently only supports either specifying parameter binding or type per parameter in the method name option. You cannot specify both at the same time, such as

     doSomething(com.foo.MyOrder ${body}, boolean ${header.high})
    -

    This may change in the future.

-

Bean Injection

+

This may change in the future.

+

Bean Injection

We support the injection of various resources using @EndpointInject or @BeanInject. This can be used to inject

@@ -1390,8 +1390,8 @@ public class MyRouteBuilder extends Rout @BeanInject MyFooBean foo; -
-

Parameter Binding Annotations

+
+

Parameter Binding Annotations

camel-core

The annotations below are all part of camel-core and thus does not require camel-spring or Spring. These annotations can be used with the Bean component or when invoking beans in the DSL

@@ -1471,7 +1471,7 @@ from("activemq:someQueue").
-

Annotation Based Expression Language

+

Annotation Based Expression Language

You can also use any of the Languages supported in Camel to bind expressions to method parameters when using Bean Integration. For example you can use any of these annotations:

@@ -1560,8 +1560,8 @@ public class MySimpleIdGenerator {
-

Groovy supports GStrings that is like a template where we can insert $ placeholders that will be evaluated by Groovy.

-

@Consume

+

Groovy supports GStrings that is like a template where we can insert $ placeholders that will be evaluated by Groovy.

+

@Consume

To consume a message you use the @Consume annotation to mark a particular method of a bean as being a consumer method. The uri of the annotation defines the Camel Endpoint to consume from.

@@ -1714,8 +1714,8 @@ Camel uses this algorithm to find the ge

Using the @Consume annotations are simpler when you are creating a simple route with a single well defined input URI.

-

However if you require more complex routes or the same bean method needs to be invoked from many places then please use the routing DSL as shown above.

-
There are two different ways to send messages to any Camel Endpoint from a POJO

@EndpointInject

To allow sending of messages from POJOs you can use the @EndpointInject annotation. This will inject a ProducerTemplate so that the bean can participate in message exchanges.

Example: send a message to the foo.bar ActiveMQ queue:

+

However if you require more complex routes or the same bean method needs to be invoked from many places then please use the routing DSL as shown above.

+There are two different ways to send messages to any Camel Endpoint from a POJO

@EndpointInject

To allow sending of messages from POJOs you can use the @EndpointInject annotation. This will inject a ProducerTemplate so that the bean can participate in message exchanges.

Example: send a message to the foo.bar ActiveMQ queue:

public class Foo {
   @EndpointInject(uri="activemq:foo.bar")
   ProducerTemplate producer;
@@ -1742,8 +1742,8 @@ public class MyBean {
     }
 }
 
-

Here Camel will automatically inject a smart client side proxy at the @Produce annotation - an instance of the MyListener instance. When we invoke methods on this interface the method call is turned into an object and using the Camel Spring Remoting mechanism it is sent to the endpoint - in this case the ActiveMQ endpoint to queue foo; then the caller blocks for a response.

If you want to make asynchronous message sends then use an @InOnly annotation on the injection point.

-

@RecipientList Annotation

+

Here Camel will automatically inject a smart client side proxy at the @Produce annotation - an instance of the MyListener instance. When we invoke methods on this interface the method call is turned into an object and using the Camel Spring Remoting mechanism it is sent to the endpoint - in this case the ActiveMQ endpoint to queue foo; then the caller blocks for a response.

If you want to make asynchronous message sends then use an @InOnly annotation on the injection point.

+

@RecipientList Annotation

We support the use of @RecipientList on a bean method to easily create a dynamic Recipient List using a Java method.

@@ -1844,8 +1844,8 @@ public class MyRouteBuilder extends Rout

Notice how we are injecting some headers or expressions and using them to determine the recipients using Recipient List EIP.
-See the Bean Integration for more details.

-

Using Exchange Pattern Annotations

+See the Bean Integration for more details.

+

Using Exchange Pattern Annotations

When working with POJO Producing or Spring Remoting you invoke methods which typically by default are InOut for Request Reply. That is there is an In message and an Out for the result. Typically invoking this operation will be synchronous, the caller will block until the server returns a result.

@@ -1951,8 +1951,8 @@ public interface Foo { String someInOutMethod(String input); } -
-
When writing software these days, its important to try and decouple as much middleware code from your business logic as possible. +
+When writing software these days, its important to try and decouple as much middleware code from your business logic as possible.

This provides a number of benefits...

  • you can choose the right middleware solution for your deployment and switch at any time
  • you don't have to spend a large amount of time learning the specifics of any particular technology, whether its JMS or JavaSpace or Hibernate or JPA or iBatis whatever
@@ -1968,9 +1968,9 @@ public interface Foo {

The best approach when using remoting is to use Spring Remoting which can then use any messaging or remoting technology under the covers. When using Camel's implementation you can then use any of the Camel Components along with any of the Enterprise Integration Patterns.

-

Another approach is to bind Java beans to Camel endpoints via the Bean Integration. For example using POJO Consuming and POJO Producing you can avoid using any Camel APIs to decouple your code both from middleware APIs and Camel APIs! (smile)

-

Visualisation

This functionality is deprecated and to be removed in future Camel releases.

 

Camel supports the visualisation of your Enterprise Integration Patterns using the GraphViz DOT files which can either be rendered directly via a suitable GraphViz tool or turned into HTML, PNG or SVG files via the Camel Maven Plugin.

Here is a typical example of the kind of thing we can generate

If you click on the actual generated htmlyou will see that you can navigate from an EIP node to its pattern page, along with getting hover-over tool tips ec.

How to generate

See Camel Dot Maven Goal or the other maven goals Camel Maven Plugin

For OS X users

If you are using OS X then you can open the DOT file using graphviz which will then automatically re-render if it changes, so you end up with a real time graphical representation of the topic and queue hierarchies!

Also if you want to edit the layout a little before adding it to a wiki to distribute to your team, open the DOT file with OmniGraffle then just edit away (smile)

-

Business Activity Monitoring

+

Another approach is to bind Java beans to Camel endpoints via the Bean Integration. For example using POJO Consuming and POJO Producing you can avoid using any Camel APIs to decouple your code both from middleware APIs and Camel APIs! (smile)

+

Visualisation

This functionality is deprecated and to be removed in future Camel releases.

 

Camel supports the visualisation of your Enterprise Integration Patterns using the GraphViz DOT files which can either be rendered directly via a suitable GraphViz tool or turned into HTML, PNG or SVG files via the Camel Maven Plugin.

Here is a typical example of the kind of thing we can generate

If you click on the actual generated htmlyou will see that you can navigate from an EIP node to its pattern page, along with getting hover-over tool tips ec.

How to generate

See Camel Dot Maven Goal or the other maven goals Camel Maven Plugin

For OS X users

If you are using OS X then you can open the DOT file using graphviz which will then automatically re-render if it changes, so you end up with a real time graphical representation of the topic and queue hierarchies!

Also if you want to edit the layout a little before adding it to a wiki to distribute to your team, open the DOT file with OmniGraffle then just edit away (smile)

+

Business Activity Monitoring

The Camel BAM module provides a Business Activity Monitoring (BAM) framework for testing business processes across multiple message exchanges on different Endpoint instances.

@@ -1996,15 +1996,15 @@ public interface Foo {

Use Cases

-

In the world of finance, a common requirement is tracking trades. Often a trader will submit a Front Office Trade which then flows through the Middle Office and Back Office through various systems to settle the trade so that money is exchanged. You may wish to test that the front and back office trades match up within a certain time period; if they don't match or a back office trade does not arrive within a required amount of time, you might signal an alarm.

-

Extract Transform Load (ETL)

+

In the world of finance, a common requirement is tracking trades. Often a trader will submit a Front Office Trade which then flows through the Middle Office and Back Office through various systems to settle the trade so that money is exchanged. You may wish to test that the front and back office trades match up within a certain time period; if they don't match or a back office trade does not arrive within a required amount of time, you might signal an alarm.

+

Extract Transform Load (ETL)

The ETL (Extract, Transform, Load) is a mechanism for loading data into systems or databases using some kind of Data Format from a variety of sources; often files then using Pipes and Filters, Message Translator and possible other Enterprise Integration Patterns.

So you could query data from various Camel Components such as File, HTTP or JPA, perform multiple patterns such as Splitter or Message Translator then send the messages to some other Component.

-

To show how this all fits together, try the ETL Example

-

Mock Component

Testing Summary Include

The Mock component provides a powerful declarative testing mechanism, which is similar to jMock in that it allows declarative expectations to be created on any Mock endpoint before a test begins. Then the test is run, which typically fires messages to one or more endpoints, and finally the expectations can be asserted in a test case to ensure the system worked as expected.

This allows you to test various things like:

  • The correct number of messages are received on each endpoint,
  • The correct payloads are received, in the right order,
  • < li>Messages arrive on an endpoint in order, using some Expression to create an order testing function,
  • Messages arrive match some kind of Predicate such as that specific headers have certain values, or that parts of the messages match some predicate, such as by evaluating an XPath or XQuery Expression.

Note that there is also the Test endpoint which is a Mock endpoint, but which uses a second endpoint to provide the list of expected message bodies and automatically sets up the Mock endpoint assertions. In other words, it's a Mock endpoint that automatically sets up its assertions from some sample messages in a File or database, for exam ple.

Mock endpoints keep received Exchanges in memory indefinitely

Remember that Mock is designed for testing. When you add Mock endpoints to a route, each Exchange sent to the endpoint will be stored (to allow for later validation) in memory until explicitly reset or the JVM is restarted. If you are sending high volume and/or large messages, this may cause excessive memory use. If your goal is to test deployable routes inline, consider using NotifyBuilder or AdviceWith in your tests instead of adding Mock endpoints to routes directly.

From Camel 2.10 onwards there are two new options retainFirst, and retainLast that can be used to limit the number of messages the Mock endpoints keep in memory.

URI format

mock:someName[?options] +

To show how this all fits together, try the ETL Example

+

Mock Component

Testing Summary Include

The Mock component provides a powerful declarative testing mechanism, which is similar to jMock in that it allows declarative expectations to be created on any Mock endpoint before a test begins. Then the test is run, which typically fires messages to one or more endpoints, and finally the expectations can be asserted in a test case to ensure the system worked as expected.

This allows you to test various things like:

  • The correct number of messages are received on each endpoint,
  • The correct payloads are received, in the right order,
  • Messages arrive on an endpoint in order, using some Expression to create an order testing function,
  • Messages arrive match some kind of Predicate such as that specific headers have certain values, or that parts of the messages match some predicate, such as by evaluating an XPath or XQuery Expression.

Note that there is also the Test endpoint which is a Mock endpoint, but which uses a second endpoint to provide the list of expected message bodies and automatically sets up the Mock endpoint assertions. In other words, it's a Mock endpoint that automatically sets up its assertions from some sample messages in a File or database, for example.

Mock endpoints keep received Exchanges in memory indefinitely

Remember that Mock is designed for testing. When you add Mock endpoints to a route, each Exchange sent to the endpoint will be stored (to allow for later validation) in memory until explicitly reset or the JVM is restarted. If you are sending high volume and/or large messages, this may cause excessive memory use. If your goal is to test deployable routes inline, consider using NotifyBuilder or AdviceWith in your tests instead of adding Mock endpoints to routes directly.

From Camel 2.10 onwards there are two new options retainFirst, and retainLast that can be used to limit the number of messages the Mock endpoints keep in memory.

URI format

mock:someName[?options]

Where someName can be any string that uniquely identifies the endpoint.

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

Options

confluenceTableSmall

Option

Default

Description

reportGroup

null

A size to use a throughput logger for reporting

retainFirst

 

Camel 2.10: To only keep first X number of messages in memory.

retainLast

 

Camel 2.10: To only keep last X number of messages in memory.

Simple Example

Here's a simple example of Mock endpoint in use. First, the endpoint is resolved on the context. Then we set an expectation, and then, after the test has run, we assert that our expectations have been met.

MockEndpoint resultEndpoint = context.resolveEndpoint("mock:foo", MockEndpoint.class); resultEndpoint.expectedMessageCount(2); @@ -2042,9 +2042,9 @@ resultEndpoint.assertIsSatisfied();

You can also define this as that 2nd message (0 index based) should arrive no later than 0-2 seconds after the previous:

mock.message(1).arrives().noLaterThan(2).seconds().afterPrevious();

You can also use between to set a lower bound. For example suppose that it should be between 1-4 seconds:

mock.message(1).arrives().between(1, 4).seconds().afterPrevious();

You can also set the expectation on all messages, for example to say that the gap between them should be at most 1 second:

mock.allMessages().arrives().noLaterThan(1).seconds().beforeNext(); -time units

In the example above we use seconds as the time unit, but Camel offers milliseconds, and minutes as well.

Endpoint See Also

[... 2273 lines stripped ...]