Apache Camel 2.19 was released on May 5th 2017 and its about time I do a little blog about what this release includes of noteworthy new features and improvements.
Here is a list of the noteworthy new features and improvements.
1. Spring Boot Improvements
The Camel 2.19 release has been improved for Spring Boot in numerous ways. For example all the Camel components now include more details in their spring boot metadata files for auto configuration. This means tooling can now show default values, documentation etc for all the options on each component, language, and data format you may use, and configure in application.properties or .yml files.
The release is also up to date with latest Spring Boot 1.5.3 release.
Some component has improved auto configuration which makes it even easier to use, such as camel-servlet where you can easily setup the context-path from the application.properties file.
We have also made available to configure many more options on CamelContext as well so you can tweak JMX, stream caching, and many other options.
2. Camel Catalog Improvements
The Camel Catalog now includes fine grained details of every artifact shipped in the release, also for the other kinds such as camel-hystrix, camel-cdi etc.
The catalog now also include all the documentation in ascii doc and html format.
The catalog has specialized providers for Spring Boot and Karaf runtimes, which allows tooling to know which of the Camel artifacts you can use on those runtimes.
The Camel project uses the catalog itself, so we now use this to automatic generate and keep a full list of all the artifacts on the website, and when each artifact was added. You can therefore see whether its a new artifact in this release, or was introduced in Camel 2.17 etc.
There is a specialized runtime version of the CamelCatalog provided in camel-core RuntimeCamelCatalog, which allows you to tap into the catalog when running Camel. The offline catalog is camel-catalog which is totally standalone.
3. Camel Maven Plugin can now validate
There is a new validate goal on the camel-maven-plugin which allows you to check your source code and validate all your Camel endpoints and simple expressions whether they have any invalid configuration or options. I have previously blogged about this.
4. Auto reload XML files
If you develop Camel routes in XML files, then you can now turn on auto reload, so Camel will watch the XML files for changes and then automatic update the routes on the fly. I have previously blogged and recorded a video of this.
5. Service Call EIP improvements
Luca has been buys improving the Service Call EIP so it works better and easier with Camel on the cloud, such as kubernetes or spring-boot-cloud.
Luca blogged recently about this.
6. Calling REST services is easier
If you want to use Camel to call RESTful services then its now easier as we add a producer side to the Rest DSL. This means you can call REST service using the rest component that can then plugin and use any of the HTTP based component in Camel such as restlet, http4, undertow etc.
For more information see the rest-producer example.
We also added a new camel-swagger-rest component that makes it even easier to call Swagger REST APIs, where you can refer to their operation id, and then let Camel automatic map to its API.
7. CDI with JEE transactions
The camel-cdi component now supports JEE transactions so you can leverage that out of the box without having to rely on spring transactions anymore.
8. Example documentation improved
We now generate a table with all the examples and sorted by category. This allows users to find the beginner examples, rest, cloud etc. And also ensure that we keep a better documentation for our examples in the future as the generator tool will WARN if we have examples without documentation.
Also all examples have a readme file with information about the example and how to run.
9. Spring Cloud components
There is new Camel components that integrate with Spring Cloud and Spring Cloud Netflix. This makes it easy to use for example the ServiceCall EIP or Hystrix EIP with Spring Cloud Netflix or just Camel with Spring Cloud in general. You can find more information in the example.
10. Kafka improvements
The camel-kafka component has been improved to work more intuitively. This unfortunately means the uri syntax has changed in a backwards incompatible way. So if you are upgrading then make sure to change your uris. However the new syntax resemble how other messaging components does it by using kafka:topicName?options.
Also the component can now automatic convert to the kafka serializer and deserializer out of the box, so you dont have to hazzle with that. We provide converts to the typically used such as byte and string types.
The component also has been upgraded to latest Kafka release and its now possible to store the offset state offline so you can resume from this offset in case you stop and later start your application.
Its also much easier to configure and use custom key and partition key which can be supplied as header values.
And there is a new Kafka idempotent repository.
11. Route Contracts
We have added initial support for being able to specify an incoming and outgoing type to a Camel route (called transformer and validator inside Camel). This then allows both Camel at runtime, and Camel developers to know what payload the routes is expected as input and what it returns. For example you can specify that a route takes in XML and returns JSon. And with XML you can even specify the namespace. Likewise you can specify Java types for POJO classes. Based on these contracts Camel is able at runtime to automatic be able to type-covert the message payload (if possible) between these types if needed.
We will continue with more improvements in this area. For example we hope we can add such capabilities to Camel components so they will be able to provide such information so your Camel routes is more type-safe with the message payloads during during routing.
And tooling will also be able to tap into this formation and then for example "flag" users with hints about routes not being compatible etc.
You can find more details in this example (we have for CDI and XML as well) and in the documentation.
12. Reactive Camel
There is a new camel-reactive-streams component that makes Camel work as first-class with the reactive-streams API so you can easily use Camel components in your reactive flows, or call flows from your Camel routes.
For the next release there is a camel-rx2 component in the works which has improved support for Camel with the popular RxJava 2 framework.
For users that want to use reactive with vert.x then there is a camel-vertx and vertx-camel-bridge components in both projects. We plan to merge them together and bring the best features from each of them together in the future, when we get some time. However Claus is in talks with the vert.x team about this.
You can find more information in some of this example. And the Camel in Action 2nd ed book contains an entire chapter 21 covering all of this.
13. Java 8 DSL improvements
And just on top of my head the Java 8 DSL has been slightly improved to allow using more of the Java 8 lambda and functional style in your Camel routes and EIPs. We will continue to improve this from time to time when we find EIPs that can be made more awesome for savvy Java 8 users. We are also looking for feedback in this area so if you are kneed deep in the Java 8 style then help us identify where we can improve the DSL.
14. Camel Connectors
We have introduced a new concept called Camel Connector. However its still early stages and we will over the next couple of releases further improve and refine what a Camel connector is.
The short story is that a Camel Connector is a specialized and pre-configured Camel Component that can do one thing and one thing only. For example if you need to known when someone mentions you on twitter, then you can use the camel-twitter component. But it can do 10 things and it can take time to understand how to use the component and make it work. So instead you can build a connector that can just do that, a camel-twitter-mention connector. It's pre-build and configured to just do that. So all you need to do is to configure your twitter credentials and off you go. At runtime the connector is a Camel component, so from Camel point of view, they are all components and therefore it runs as first-class in Camel.
We have provided some connector examples in the source code.
15. Many more components
As usual there is a bunch of new components in every Camel release and this time we have about 20 new components. You can find the list of new components in the release notes, or on the Camel components website where you can search by the 2.19 release number.
For example there is a camel-opentracing component that allows to use Camel with distributed tracing. Gary Brown has blogged about this.
There is also a few new Camel components for IoT such as camel-milo that Jens Reimann blogged about.
There is a bunch of other smaller improvements which you can find in the release notes. For example the jsonpath language now allows to use embedded simple language, and you can define predicates in a much simpler syntax without too many of the confusing jsonpath tokens, in case you just want to say order.customer.id > 1000 etc.