Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Why Using Camel Was the Right Choice

DZone's Guide to

Why Using Camel Was the Right Choice

It can take a bit of work to transform your mental model of a problem into the EIP domain, but when you do, the solution will be far easier to understand later on.

Free Resource

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

Around a year ago, we made the decision to write a new API integration layer with Camel. No one on the project had a great deal of experience with Camel, but we completed and deployed the API and it has been running faithfully ever since.

The choice to use Camel was somewhat controversial. It took developers a little while to get accustomed to the DSL syntax, and there were many debates over exactly what the code should look like.

We eventually moved away from Camel for newer API projects, but I recently had to go back and update some of the Camel code. What I found looking at the code a year or so after it was written surprised me.

At the time, thinking in terms of Enterprise Integration Patterns (EIPs) was quite novel. Terms like multicast, recipientList, aggregate, and wireTap were often hard to appreciate, and harder still to incorporate into a process. We persevered, though, and for the most part, we managed to describe the transformation and integration of data with these patterns. It was sometimes frustrating to try and mold our thinking into these EIPs, and I suspect that in large part, this frustration was the reason why we didn’t embrace Camel for future projects.

However, I have to say that reading this code after enough time had passed for me to forget the details was refreshing.

Too often, code is dumped into classes in an imperative train of thought style that makes perfect sense when you are knee deep in a problem and just need to get something working. However, it is so painful to read later on because, without the mental context of the original developer (even if that developer was you), it takes hours to step through each line of code to determine the intent as well as the action.

For all the rough edges we encountered writing a Camel application, being forced to use the common language exposed by EIPs forces you to write much more declarative code. It can take a bit of work to transform your mental model of a problem into the EIP domain, but when you do, the solution will be far easier to understand later on.

I didn’t appreciate it at the time, but describing and implementing a solution with EIPs and the common language that they enforce had more than enough value to overcome the time it took to learn this style of coding. I’m a little disappointed that we discounted Camel for the short term frustrations it brought to our development cycle, but maybe you can learn from my mistakes.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:
integration ,camel ,eip ,api

Published at DZone with permission of Matthew Casperson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}