2010-12-21

Camel 2.6 - Using done files with file/ftp components

The upcoming 2.6 release of Apache Camel now supports using "done files" with the file/ftp components. The "done file" is a marker file which signals that the target file is ready for the consumer. You can use this when exchanging data using files and want to avoid the consumer to pickup the target file before its ready (= done).

Mind that Camel also has a number of other features
for detecting if a file is ready,
 which you can read about the readLock option.

For example if write a file with the name yyyyMMdd-report.txt and want to write a done file using the syntax file name .done, then you can do as follows:

.to("file:reports?fileName=${date:now:yyyMMdd}-report.txt&doneFileName=${file:name}.done");

Notice the new doneFileName option where we define the pattern of done file. It supports two dynamic placeholders which is ${file:name} and ${file:name.noext}. The latter is the file name without the extension.

The "done file" must be located in the same directory as the target file.

On the consumer side we can do as follows:

from("file:reports?doneFileName=${file:name}.done")
    .to("bean:fileService");

Which tells Camel to only pickup files if a done file exists with that given name pattern.

And all this works as well with the FTP components.

2010-12-10

Camel in Action is done

This is a follow up post on what Jonathan announced yesterday - Camel in Action is complete.

This is what Manning told us in an email on December 9th 2010.

     Yes, we're done. More importantly, you're done! Congratulations!!



Lets see if I can dig out some numbers for this project.

Stats:
First mail: 2009-02-15
Last mail: 2010-12-09
Mail threads: 572 (this is not total number of mails, just number of individual conversations)
MEAP updates: 9
Manuscript completed in: 13 months
Production phase: 5 months
Bestseller: 10th spot all time bestseller 2010 (the book is frequent in top 10 bestseller of the week)
Pages: 542
Chapters: 14
Appendixes: 5



Story:
So it all started in start of February 2009, when Hadrian contacted me about this book project. Hadrian responded to Manning on 2009-02-15 which you may say its where the ball started to roll about this project. Hadrian and I had to come up with a book plan later, and all what follows to get the a book project started. Three weeks later we had external people review our book proposal, which provided great feedback.

Manning decided to move forward and on the 2009-03-24 they opened up discussing a contract.
I signed the contract on the 2009-04-02.

We got started on a bumpy ride with the project. It took almost 6 weeks after we where supposed to get started before I finally had cleared my path and was ready to really dig in. So on 2009-07-04 I started OpenOffice and started to dig in.

Hadrian didn't seem to be able to find time to work on the project, so after a while it was clear we needed help, and then Jonathan came aboard. The book project was back on track and we and Manning had regained or trust that we could make this happen.

Jonathan was on a roll from the very start and he crafted a really great chapter 2. A month later we had our deadline to deliver 4 chapters for the MEAP to go online.  On the 2009-10-22 the Camel in Action book was up for sale at Manning. The first goal of our contract was fulfilled.

Then there is a long period with just hard work. I spend nearly all my weekends writing on the book. Some weekend I was able to spend 2 x 8 hours. Others just a couple of hours. I found that I was most productive on the weekends when I could get started in the morning. During weekdays, after work, you would not be able to work as much. Those days was best spent doing polishing, review and the likes.

We wrote and developed the chapters until mid July 2010 where we delivered the final manuscript. That means we handed over 14 chapters. The appendixes would be written thereafter. During the MEAP period we posted 9 updates. I think this is great for our readers, that they would get frequent updates of the book, along as its being written.

We got in talks with Martin Krasser about him being a guest author for a new appendix about Akka and Camel. We are both admires and think the Akka project is really cool. And having Martin write this would be the best as he is in fact committer on both projects and coded the Camel integration in Akka. Yes as a reader you get the information is from the source. Later this month this appendix will be given free at the Manning website. So keep an eye when that happens.

So after 4 - 5 months of being in whats known as the product phase (copy editing, type setting etc.), the book is done.

I recently spoke to Manning about how the sale of the book is going. They are very pleased with the book. We have sold 1807 copies (2010-12-05) from MEAP. This number is only sales from the Manning website. Whatever Amazon have sold is not included. They haven't disclosed that figure to us yet. The book is at the press currently, and Manning have ordered about 4500 for the first print (hardcopies). So all together that is a good sign there is a strong interrest in Camel in the community.

That's it.

And if you wonder if the book is any good? Then this quote from the Camel father (James Strachan) says it all "I highlight recommend this book. It kicks ass!"

Wonder what would be my next project :)

2010-12-09

Upcoming Webinar - Getting started with Camel and deployment options

FuseSource is hosting a live webinar on thursday the 16 th. December 2010.

Description:
This webinar describes the various deployment options for Apache Camel.

Learn how to easily use and leverage the power of Apache Camel and Enterprise Integration Patterns in a range of deployment options varying from plain java applications to full blown SOA implementations.

Designed from the ground up to be an easy-to-use integration framework, great value is provided to any developer with a need to integrate by providing a breath of connectivity options and implementations of the Enterprise Integration Patterns. By not relying on a heavy specification as starting point, Apache Camel has no dependency on a runtime container and has virtually endless deployment options.

Please join us for this free and interactive webinar that explores the deployment options of Apache Camel, whether you want to deploy with a messaging backbone such as FUSE Message Broker, a full ESB such as FUSE ESB or within your own plain Java or Java EE application this webinar covers the various deployment options available.

This webinar includes:
Apache Camel basics and deployment options
demo with code samples
interactive Q&A
how to use open source software to cut costs
how to get enterprise-class services and support

The presentation will introduce FUSE Mediation Router, a productized and fully supported distribution of Apache Camel that is designed for enterprise use. Be sure to join us for this informative and interesting session.


Date and time:
Thursday, December 16, 2010 5:00 pm
Europe Time (Amsterdam, GMT+01:00)

Thursday, December 16, 2010 8:00 am
Pacific Standard Time (San Francisco, GMT-08:00)

Thursday, December 16, 2010 5:00 pm
Europe Time (Paris, GMT+01:00)

Thursday, December 16, 2010 9:00 am
Mountain Standard Time (Denver, GMT-07:00)

Speaker: Scott Cranton

Duration: 1 hour

Registration:
Use this link to read more and register if you want to attend the webinar.

2010-12-07

Camel 2.6 - Improved management of custom processors and beans

I think its time for a non book related blog entry so here goes.

I have been having "fun" with the JMX API lately. I wont get into how utterly SUN managed to mess up from framework developer point of view. I am still puzzled why they didn't ship annotations in the JDK that allows you to decorate your beans for management. Just as the Spring guys already have done.

Anyway you may want to use custom business logic with Camel using a org.apache.camel.Processor or even better as a POJO.

Now in Camel 2.6 onwards the processors and beans which are defined in the Camel routes will now also be enlisted in JMX for management. By default they provide basic information, but you may want to expose some custom attributes and/or operations as well.

Now this is possible simply by decorated your processor/bean using the Spring JMX annotations. Camel detects the @ManagedResource annotation on takes it from there.

The only issue is that your custom processor/bean wont have the basic information that Camel usually provides, such as performance statistics. The reason is the aforementioned JMX API being a pain in the ****.

If you want to look for an example then I have updated this old FAQ entry about this new change.