Yes. Have integrated Apache Camel with Spring. It helps in utilizing features like Spring Dependency injection, Datasource and Traction management.
In simple terms, a component refers to an external entity that is communicating with camel. To write a camel route that work with files, file component is to be used. Similarly to work with JMS queue, jms component has to be used.
Ex – A FileComponent is referred to by file in a URI and it creates FileEndpoints.
The CamelContext represents a single Camel routing rulebase. We use the CamelContext in a similar way to the Spring ApplicationContext. public interface CamelContext extends SuspendableService, RuntimeConfiguration. Interface used to represent the context used to configure routes and the policies to use during message exchanges between endpoints.
An exchange is created by the endpoint.
At a very abstract level, camel can be introduced as a routing engine. Camel allows us to define our routing rules to route messages from specified source to destination.
Camel provides inbuilt support for many protocols which makes it easy for us to integrate different systems.
For ex: Camel can easily integrate two different applications working in ftp and jms respectively. Internally Camel performs all the required protocol and datatype conversions for us.
Have integrated Apache Camel with Spring Boot. Made use of Apache Camel Spring Boot starter dependency. Apache Camel + Spring Boot
Any platform supporting JDK 6.
We regularly test Camel on Linux, Windows and OS X.
Camel 2.6 or older can run on JDK 1.5 or better.
Camel 2.7 onwards requires JDK 1.6 or JDK 1.7.
Camel 2.14 onwards requires JDK 1.7 or better.
Camel 2.18 onwards requires JDK 1.8.
Typically vendors claim practically everything is an ESB these days, so the wer is probably yes (smile)
However our view is that an ESB is more of a container of integration components, so we view Apache ServiceMix to be a true ESB based around OSGi (and optionally JBI) to provide a standards based integration platform of components.
We view Camel as being a rule based routing & mediation engine which can be used inside a full blown ESB, a message broker or a web services smart client. Though if you want to, you could consider that Camel is a small, lightweight embeddable ESB since it can provide many of the common ESB services like smart routing, trformation, mediation, monitoring, orchestration etc.
It is now possible to define routes outside <camelContext/> which you do in a new <routeContext/> tag. The routes defined in <routeContext/> can be reused by multiple <camelContext/>. However its only the definition which is reused. At runtime each CamelContext will create its own instance of the route based on the definition.
Camel is designed to be small lightweight and extremely modular so that you only pay for what you use. The core of camel, camel-core.jar is small and has minimal dependencies.
On Java 6 camel-core.jar only depends on
commons-management.jar (for Camel 2.8 or older)
commons-logging.jar (for Camel 2.6 or older)
slf4j-api.jar (from Camel 2.7 onwards)
On Java 5 camel-core.jar depends also on activation.jar and a JAXB2 implementation which typically involves jaxb-api.jar, jaxb-impl.jar and a StAX API which may be stax-api.jar and *woodstox.jar
The data is passed in the routes as an object of the class org.apache.camel.Exchange.
A camel endpoint is similar to an entity that is capable of sending or receiving messages. For e.g., a JMS queue can be treated as an endpoint.
Using CamelSpringTestSupport - Apache Camel Unit Testing
There are two types of message exchange patterns in Camel:
In Only: In this exchange pattern, consumer creates a exchange which only contains an In message.
In Out: In this exchange pattern, consumer creates a exchange which also contains reply message for the caller.
Out of above two, InOut pattern is synchronous because caller expects for an acknowledgement or reply for each exchange sent.
A camel route is similar to a channel though which data flows. Producer and consumer are two endpoints that are present at each end of the channel.
A consumer endpoint is the starting point of the route. A definition of a camel route starts by writing a camel consumer endpoint.
A producer endpoint appears (not always) at the end of the route. It consumes the data that is passed through the route.
A redelivery policy defines rules when Camel Error Handler perform redelivery attempts. For example you can setup rules that state how many times to try redelivery, and the delay in between attempts, and so forth.
Exception can be handled using the <try> <catch> block, <OnException> block or the <errorHandler> block.
The errorHandler is used to handle any uncaught Exception that gets thrown during the routing and processing of a message. Conversely, onException is used to handle specific Exception types when they are thrown.
A Camel Exchange can be called as an holder for holding message during routing. A exchange supports various message exchange patterns, like InOnly and InOut.
Following are the contents of camel exchange:
ExchangeId: A unique identifier for each exchange
Message Exchange Pattern: This field denotes whether you are using InOnly or InOut exchange pattern.
Exception: If any exception occurs during routing, it will be available in this field.
Properties: These are the properties that are available for entire duration of exchange.
In Message: This is mandatory field which contains the input message.
Out Message: This is optional message which exists only if MEP is InOut.
The message to be routed in Camel route is present in the Exchange. It is the message holder. Apache camel uses Message Exchange Patterns(MEP). Apache camel exchange can hold any kind of message. It supports a variety of formats like xml, JSON etc.
ESB stands for Enterprise Service Bus. It can be defined as a tool designed to help implement an application using SOA principles Not for all projects projects is the use of ESB an optimum solution ESB should be used when projects involve integrating a number of Endpoints like Webservices, JMS, FTP etc. Have deployed JBoss Fuse ESB for Apache Camel Deployement.
Although camel supports many features similar to ESB like routing, trformation etc., we cannot call camel as ESB because it does not have a container like ESBs. However, we can deploy camel on to some ESB container like service mix.
A camel Exchange can hold any sub type of java.lang.Object including primitive data types.
Apache camel provides us with a number of components. These components make interacting create endpoints with which a system can interact with other external systems. For example using an ActiveMQ component we expose an ActiveMQ endpoint for interaction with external system. There are more than 100 components provided by Apache Camel. Some of them are FTP,JMX, Webservices, HTTP. Apache camel also allows users to create custom components.
Here are examples of FileComponent, JMSComponent, CXF Component.
URI is a naming scheme used in camel to refer to an endpoint. An URI tells camel, the component being used, the context path and the options applied against the component. URI contains 3 parts:
Example of a file URI working as a consumer :
from("file:src/data?fileName=demo.txt&fileExist=Append");
Here the scheme points to file, the context path is “src/data” and the options are “fileName and fileExist” are options that can be used with file component or file endpoint.
We often talk about that Camel is a mediation and routing framework; so what exactly is a router and what does it do?
Basically a router just consumes Message exchanges from some Endpoint, then sends them on to some other Endpoint using some kind of Enterprise Integration Patterns.
For example a router could implement the Content Based Router pattern, to route from an endpoint to one or more destination endpoints using a Predicate based on the message content.
Typically a route or router consists of one or more consumers; either an Event Driven Consumer or a Polling Consumer or possibly a Tractional Client. Then there are one or more Processor instances which could send the message to one or more endpoints.
The core functionality of Apache Camel is its routing engine. It allocates messages based on the related routes. A route contains flow and integration logic. It is implemented using EIPs and a specific DSL.
Routes in a variety of domain-specific languages (DSL).The most popular ones are Java DSL - A Java based DSL using the fluent builder style. Spring XML - A XML based DSL in Spring XML files.
Using Apache Camel SQL component.
Apache Camel + SQL component(MySQL DB)
This software is open source using the Apache 2.0 licence (a liberal BSD style license which is very commercial friendly)
Camel is very lightweight routing engine that allows us to integrate different applications with minimal configuration. Inbuilt support for different protocols allows a developer to focus on business problem than on integration problem. Camel routing is not restricted to xml payload but it can route any type of message. Camel test kit further helps to test the solution.
Yes. Using Apache CXF exposed a webservice to be consumed. Used Contract first approach to generate the classes from wsdl.
Yes. Have integrated Apache Camel MySQL Database using SQL Queries
Camel supports the Message Endpoint pattern using the Endpoint interface. Endpoints are usually created by a Component and Endpoints are usually referred to in the DSL via their URIs.