2013-10-26

A new book - Instant Apache Camel Messaging System

Its great to see the Camel community goes from strength to strength over the years. And this year there is three new books being published.

One of the books is titled - Instant Apache Camel Messaging System, by Evgeniy Sharapov. Published by Packt publishing in September 2013.


This week I had the pleasure of reading the book. Its a short book with 78 pages (111 on my iPad mini) and I was able to read it in two evenings. I enjoyed reading the book as it was well written, the english language and grammar is spot on, and there is a "red line" that takes you through the content, with nice transitions from one section to the next.

This book covers the following topics
  1. What is Apache Camel
  2. Installation
  3. Quickstart creating your first Camel project
  4. Top 6 features
  5. Where to find more information in the community

Ad 1 - What is Apache Camel

The book explains what Apache Camel is in 4 pages. It is a good attempt, but I would liked to see more details, and a figure to better explains the relationship with Camel, Components, Routes, and EIPs.

Ad 2 - Installation

Installing Apache Camel is focused primary on using Apache Maven as the built tool, and this book, covers how to create a new generic Maven project from the command line, and then how to add Camel dependencies, and prepare the project for Eclipse or IDEA editors. Though the author also covers how to manually download and unzip the Apache Camel distribution and how to add JARs to your project.
Along the way in the book there is small screenshots of the example project structure and code listings of the Maven pom.xml file and other important pieces to highlight. The author has done a great job striking a balance to the reader so he can easily follow what is going on. I really like its the same example that is used throughout the book, and is being modified on the way, as Camel's functionality is unlocked.
I would have liked to see how to create new projects without the command-line such as from the wizards built-in Eclipse. That is easier today as Maven is provided out of the box in Eclipse.

Also mentioning about the Camel Maven archetypes would have been good. 

Ad 3 - Quickstart

In the quickstart chapter we develop a small Camel application that logs a message to the logger, using a Camel route. The content is good and I like there is a screenshot figure of running the application, which shows the reader what happens.

The book also goes a bit deeper explaining what CamelContext, and RouteBuilder is. And how the quickstart application works. 

Ad 4 - Top 6 features

This chapter is covering 6 must-know features - though unfortunately the author does not summarize which 6 features that would be. 

What is covered is:
- Some Camel concepts such what is a Message / Exchange
- Using Camel Main support
- Testing Camel applications with and without Spring
- Routing with Java and XML DSL
- Transformations
- and very briefly talks about EIPs (frankly to short)

This is the big and main chapter of the book, that uses the same example which we then add functionality on the way - this is very good. Later in the chapter a new real-life example is being covered about custom document declarations. This is a very good example, and the reader learns how to use content based routing, xpath and java predicates, xslt transformation, using JAXB, and how to write Camel type converters, and a little bit about JMS, and how to put  that together and unit test as well. The reader is also shown how to build unit tests, and touching how to advice the routes during testing to mock/replace parts making unit testing in isolation easier.

There is a few minor information that could have been updated. When you write a custom Camel type converter, you should use the fully qualified classname of the type converter classes in the META-INF/.../TypeConverter file. This is what we recommend.
Also writing a custom type converter for XML -> your JAXB object is not needed as just use camel-jaxb and include the jaxb.index file and Camel has a fallback type converter built-in that does this out of the box.

All together a great example that shows more of Camel powers at the time, when the reader is ready to learn more. Very well done by the author.

Ad 5 - More information

The book ends with some details where to find more information, such as other books, and online material on other web sites, user forums such as stackoverflow, and Camel bloggers.

A nice touch but I would have liked to see a bit more detail, as the Camel community is vast, and there is a lot of information out there.


Summary

This is a great book for new users to Apache Camel, who are looking for practical examples how to get started using Apache Camel, who may not be able to find such information in one place. All the information you need to get started with Camel is there at your fingertips, but you have to be prepared for being practical and try the source code of the book. This book is not for experience Camel users, whom already have built a couple of Camel applications.

After reading this book you will be much better prepared to be successful and be able to learn more and use Apache Camel in your day time job.

The information in the book can be found freely available on the internet today, but you will need to jump between content and that would take you a much longer time, than it would be to just purchase this eBook and in a few days be prepared for working with Apache Camel.

The title of the book is misleading, I blame the publisher, for not taking the title serious. There is another book that hit the market with a similar scope and title. Readers are being mislead. This book doesn't cover messaging. Its a beginner/introductory book. Use that in the title! It seems the publisher takes some integration like words and put together at random. What if the title was: Instant Concise Application Messaging Exchange Language (hint) - that would be confusing as well.

A IMHO better title could have been using words like:
  • Get started with Apache Camel
  • Learning Apache Camel
  • Practical Apache Camel 
  • Beginning Apache Camel
Though possible could be more creative with the title, and maybe something like: Instant learn using Apache Camel in 2 days.

Okay besides the title, the book is only for new users, but its a great book.

Rating: **** (4 out of 5) based on being a highlight practical book for new Camel users, that is easy and fun to read. After reading the book you have a feeling to learn more, and wished the book had more pages. 

What's next

Along the way you may want to read these freely available information as well. They explain what Apache Camel is in more detail, and also goes more in deep with the Camel concepts with is important to know. 


If you intended to go on using Apache Camel, then you may want to pickup another books that goes much more in depth what Apache Camel can do. Today on the market there is:

- Apache Camel developers handbook (to be published later this year)

Disclaimer: I am co-author of the Camel in Action book.

And I end this blog by congratulating Evgeniy Sharapov for authoring a great Apache Camel beginner book, that is a joy to read. You sure have flair and talent for writing. Hope this is not the last book from your hands.



2013-10-22

Apache ActiveMQ 5.9 released

The Apache ActiveMQ team has just released the new ActiveMQ 5.9 release.

Apache ActiveMQ 5.9 released
This release is 8 months of hard work since the previous 5.8 release.

In this release we have as usual more hardening of the broker, and the recent new protocols such as AMQP and MQTT. Also very interesting is the hardening of the leveldb persistent store, which now also includes a new replication functionality. Over time level db is planned to be default out of the box persistent store, instead of the current kahadb store. Though we are not there yet, so kahadb is still the default store.

Another great new functionality is the ability to do runtime configuration changes to the broker without having to restart the broker. You cannot change everything yet, but you can for example update network connectors when you have clustered brokers etc. The documentation details which parts can be updated.

For the Camel users then there is a new broker component which allows lighter inter broker routing. Rob Davies have previously blogged about that, and provides an interesting use-case which allows to use Camel routing logic to decide if sending a message to a queue should go into the queue, or to another queue, depending on the current queue depth.

Last but not least Apache ActiveMQ now ships with hawtio as its new web console out of the box. The old web console is still there, but is considered deprecated.

We also cleaned up in the conf directory, moving all the example configurations into examples/conf.

Apache ActiveMQ 5.9 release notes is here.

Starting Apache ActiveMQ

To try out Apache ActiveMQ is easy. You go to the activemq.apache.org web site and click the download link. Then you can download a zip or tgz file of the distribution. Then you unzip/untar the file and then you can start the broker from the command line as shown below

davsclaus:/opt$ tar xf ~/Downloads/apache-activemq-5.9.0-bin.tar.gz
davsclaus:/opt$ cd apache-activemq-5.9.0/
davsclaus:/opt/apache-activemq-5.9.0$ bin/activemq console

When the broker is staring up it now logs all the transport connectors it provides and their urls.
From the logs below we can see that ...

 INFO | Listening for connections at: tcp://davsclaus.air:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector openwire started
 INFO | Listening for connections at: amqp://davsclaus.air:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector amqp started
 INFO | Listening for connections at: stomp://davsclaus.air:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector stomp started
 INFO | Listening for connections at: mqtt://davsclaus.air:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector mqtt started
 INFO | Listening for connections at ws://davsclaus.air:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector ws started

we have the following transport connections enabled

  • openwire - is the JMS protocol
  • amqp - AMQP 1.0
  • stomp - is a very simple text based protocol, you can use from telnet 
  • mqtt - for machine to machine communication
  • ws - websocket (stomp or mqtt)

Telnet to the broker

For example with stomp we can connect to the broker using telnet, and type in the telnet shell stomp commands to connect, send and receive messages. For example to connect i can type

telnet localhost 61613
CONNECT
login:foo
passcode:bar

^@

And the broker will response with

CONNECTED
heart-beat:0,0
session:ID:davsclaus.air-61798-1382433481104-2:1
server:ActiveMQ/5.9.0
version:1.0

And I can then disconnect with

DISCONNECT

^@
Connection closed by foreign host.

There is a user guide here how to use telnet with stomp.

Accessing the web console

When ActiveMQ broker starts up it logs the url for the web console(s)
 INFO | ActiveMQ WebConsole available at http://localhost:8161/

So just open a broker on that link. When you access the console its secured, so you need to login. The broker comes with a default user and password, which you can see in the conf/users.properties file.

There is also a docs/WebConsole-README.txt file that provides more details about the web-consoles, and how you can turn on|off login etc.

For example with hawtio web console we can create queues, and send messages to the queues. In the screenshot below I have created two queues: beer and wine, and send a message to the beer.
hawtio web console - comes out of the box in the new Apache ActiveMQ 5.9 release.
The console has actions to move messages between queues, browse, and delete. And messages in dead letter queues, can be resubmitted to their original queue, which allows to retry processing the message(s).


Trying the ActiveMQ web examples

Apache ActiveMQ comes with a few web examples you can try by starting the broker as follows
bin/activemq console xbean:examples/conf/activemq-demo.xml

To try the examples then open the web browser at http://localhost:8161/ and click on the last link. PS you should also try clicking on the web console link (hawtio) as the web console now also shows the Camel plugin, as one of the examples is using Camel.



2013-10-11

Sneak peak of JBoss Fuse 6.1

Yesterday James Strachan blogged about some of the stuff the fuse team has hacked on this year, which is included in the upcoming JBoss Fuse 6.1 release, due out at the end of this year.

James doesn't blog as often, so when he does, its really worthwhile the read.

Just an eye candy screenshot here about one of the new functionalities that James talk about - ActiveMQ topologies. This functionality is the latest to the game, and was created after the Fuse team had a face to face in Dublin 2 weeks back.

ActiveMQ broker topologies in Fuse Management Console (hawtio branded)
The web console from the screenshot is a Red Hat JBoss branded hawtio, its the same code and plugins underneath as you have in the hawtio project. Anyone can customize and do their own branding in hawtio - how hawti is that :)

So if you want to see more eye candy and read what's coming then read what James blogged.

Mind that this is just some of the stuff included, there is even more to come - for example a Camel data mapping tool, and log analytics is yet to be polished a bit more.

Later this month a beta release of JBoss Fuse 6.1 is expected to hit the streets, then you can try this out yourself. If not we have daily EA builds that (sometimes is broken), you can try as well.

And you can catch the fuse team on IRC, if you want instant help or wanna chat via #fusefabric on irc.freenode.net.