2013-08-28

Video presentation - Connecting Applications Everywhere with ActiveMQ

This morning while having my morning coffee I watched this video presentation on my iPad.

Connecting Applications Everywhere with ActiveMQ / JBoss A-MQ
Its a 45 minute presentation by Rob Davies, whom is also working in the JBoss Fuse team. In Rob's talk he gives a run down of ActiveMQ and JBoss A-MQ, and how its multi protocol support enables the internet of things, and connecting anything together. In the last 10-15 minutes of the talk, Rob dives a live demo (see screenshot), where he is using a micro controller to capture the sound and send the data over wifi to his laptop using MQTT and then bridging over AMPQ, and then eventually to a HTML5 client using web-socket. 

A really good presentation and demo. It was a great start of my day watching this presentation.
If you notice from the demo then Rob uses the Apache ActiveMQ 5.8.0 release out of the box. 

The video is available from dzone and you can watch it without registration or any kind of hazzle.






2013-08-21

Apache Camel 2.12 - Backoff support for less aggressive polling routes

This is another blog post about some upcoming improvements and new features in the next Apache Camel 2.12 release.

In the last blog I spoke about cron expressions directly supported in the routes. This blog post is related as we have another new feature to the polling routes (using scheduled polling consumers).

The scheduled polling routes will by default poll for new messages at a fixed rate (usually every half second). Though in some use-cases new messages does not arrive evenly spread over the day, but may tend to arrive in batches. So during the times where there is no new messages arriving, the scheduled polling consumer, would not pickup new messages, but still keep looking for new messages at the same pace.

So what we have introduced is a backoff that allows you to let the scheduled polling consumer check less aggressive when there is no messages.

To support that we have introduce 3 new options


  1. backoffMultiplier = To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
  2. backoffIdleThreshold = The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
  3. backoffErrorThreshold = The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.

The scheduled Polling Consumer is by default static by using the same poll frequency whether or not there is messages to pickup or not. From Camel 2.12 onwards you can configure the scheduled Polling Consumer to be more dynamic by using backoff. This allows the scheduler to skip N number of polls when it becomes idle, or there has been X number of errors in a row. See more details in the table above for the backoffXXX options.

For example to let a FTP consumer backoff if its becoming idle for a while you can do:

from("ftp://myserver?username=foo&passowrd=secret
      ?delete=true&delay=5s
      &backoffMultiplier=6&backoffIdleThreshold=5")
  .to("bean:processFile");

In this example, the FTP consumer will poll for new FTP files every 5th second. But if it has been idle for 5 attempts in a row, then it will backoff using a multiplier of 6, which means it will now poll every 5 x 6 = 30th second instead. When the consumer eventually pickup a file, then the backoff will reset, and the consumer will go back and poll every 5th second again.

In JMX you can see whether the backoff has kick-in, as the consumer would have the attribute backoffCounter > 0.

You can find more details at

2013-08-15

Apache Camel 2.12 - Even easier cron scheduled routes

In the upcoming Apache Camel 2.12 we have recently introduced a SPI that allows to plugin different schedulers for scheduled based consumers.

So the motivation is that some Camel components has scheduled consumers, most know is the file and ftp consumers. By default they use the scheduler from the JVM that can schedule based on a fixed period. Though with the SPI we now allows a different scheduler to be used instead.

We have two cron based schedulers ready out of the box in the camel-quartz2 and camel-spring components. So you pick you favorite, or dive in and build your own scheduler.

CRON expression
So if you want to pickup files during working hours (polling every 10th second) on weekdays you can easily do this now (notice we use + as space separator)

... with Spring

<route>
<from uri="file:inbox?scheduler=spring&scheduler.cron=0/10+6-18+*+*+MON-FRI"/>
...

... with Quartz

<route>
<from uri="file:inbox?scheduler=quartz2&scheduler.cron=0/10+6-18+*+*+MON-FRI"/>
...

In older releases of Camel you would need to sort to use a route policy, to implement a similar solution. There is a cron based route policy that can be used to setup cron expressions when a route should be started, and when it should be stopped. Though with this new functionality in Camel 2.12, its even easier to just define the cron expression in the endpoint uri directly.

There is more details in the Camel docs at

And yeah camel-quartz2 is also a new component in the upcoming Apache Camel 2.12 release. In fact we have already 14 new components. You can peak at the work in progress release notes to see what is coming down the road.

2013-08-02

Apache ServiceMix How-to book published

A few months ago a new book hit the market.

Apache ServiceMix book, recently published. Authored by Henryk Konsek.
Apache ServiceMix Hot-to, authored by Henryk Konsek, who is also a Apache Camel committer.

First I want to congratulate Henryk for being published - welcome to the club. I received my hardcopy of the book a couple of weeks ago. My part of this book was helping Henryk being a reviewer.

The book is a practical how-to book with 19 recipes for using and working with Apache ServiceMix. Starting how to install and start ServiceMix, and showing how the shell and web-console works, as well how to access the logs, install applications and the likes. And then covering some examples how to develop and deploy Camel and CXF based applications.

The book is great for new and intermediate users of Apache ServiceMix. Users with many years of ServiceMix knowledge would surely already know most of the content of the book.

And you can read the book over a weekend, its 53 pages.