Versions Compared

Key

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

...

This illustration shows how an endpoint works together with an exchange, producers, and consumers.

...

Producer

A producer is an abstraction that refers to an entity that is capable of transmitting a message to an endpoint. When a message is sent to an endpoint, it is the role of the producer to handle the details of getting the message data compatible with that particular endpoint.

For example, FileProducer will write the message body to a java.io.File format. While, JmsProducer, will map the message to javax.jms.Message before sending it to a JMS destination. This is an important attribute of Camel, since it hides the complexity of interacting with any one particular transports. All you need to do is route a message to an endpoint, and the producer will do all of the heavy lifting.

Consumer

A consumer is a service that receives messages produced by an external system, then wraps them in an exchange, and sends them onward to be processed. Consumers are the source of the exchanges being routed in Camel.

To create a new exchange, a consumer will use the endpoint that wraps the payload being consumed. A processor is then used to initiate the routing of the exchange in Camel via the routing engine.

Camel has two kinds of consumers: event-driven consumers, and polling consumers (or scheduled polling consumers). The differences between these consumers are important, because they help solve different problems.