Skip to main content

Tooling guide for Getting Started with Apache Camel in 2021

Getting Started with Apache Camel ? This post is for you. But I am not going to dive into how to write the Camel route, there are plenty of materials out there that do a better job than me. A good place to get started is the one and only Camel Blog, it gives you all the latest and greatest news from the community. If you want to start from the basics, I highly recommend Camel in Action II Book. It has everything you need to know about writing Camel. Or join the Camel community mailing list or Zulip chat  to ask questions, it's very friendly and welcoming.

If you are a returning Camel rider, I would go through this post, where it will get you up to speed on what to expect.  Another good resource is the FAQ page. I found the majority of the getting started enquiries can be found here. 

This post will be about tools that can help you, when it comes to running a Camel application in its lifetime. From design, implementation, testing, deployment and monitoring. Of course this is strictly my opinion. Any suggestions or comments are welcome.

Here is a quick collection of the tools I recommend. 



Design & Implementation


There are several different IDEs out there that have language support for Camel. My current goto is the Visual Code Studio. VS Code itself has very primitive support for Java developers, but it comes with a large variety of extensions for you to customize it, and install all the tools you need. Speaking of extension, there is a must have… “Extension Pack for Apache Camel by Red Hat”. It contains the essentials for developing Camel. I recommend checking out the Aurélien Pupier youtube channel for updates! 


To begin a project, it’s always good to have some help to set the basic structure. You can either use the Project Initializer that comes with the Apache Camel by Red Hat Extension in VS Code that will generate the base project for you. Or you can always go to the Quarkus start coding page, adding the Camel dependencies to create the base project, but one downside of the Quarkus start coding page, it will not create the template extended RouteBuilder class for you. 


No matter what runtime you choose, you are still writing Camel DSL (Domain Specific Language), you have the latest and greatest support from the camel extension, where it will help you with autocomplete, validating your Camel code.  





Mapping data between formats can be tedious, especially with larger documents or more complex structure. But using the



tooling can help you map between two data sources with a drag and drop user interface, so you will be able to visualize the mappings. The tool will generate an “.adm” file, place the file into your Camel project. You can then use the camel-atlasmap components to run the mapping.  



from("servicenow:xxxxxx....")

  .split().body()

    .marshal().json()

    .to("atlasmap:servicenow.adm")

    .to("kafka:xxx?brokersxxx")


RESTful API is another popular implementation in Camel, I highly recommend you take advantage of the Apicurio project, where it provides a GUI interface for designing the API contract. Making contract first application development a lot easier. For more details, take a look at my previous blog





Another nice complements to the toolset is the Camel Designer, this is another extension in VS Code by Bruno, this can help you visualize the design of camel processing flow. So you will be able to see what your camel route does in a quick glance.





Testing 


Camel can easily wire up unit tests in your preferred testing framework. My past experience has been great with using JUnit for creating my test cases.  


What I normally would do is create a java Class for each test case (Extend “CamelTestSupport” class). Where it can kick off your camel route with mock endpoints, loading set of data or even stub out the actual endpoint


When testing integration, introducing Behavior-Driven Development(BDD) Testing is a development practice, as it’s black box testing nature allows it to better mimic user input and expectation, and can test more complex scenarios when compared to Test-Driven Development(TDD). Consider using the “Citrus Testing Framework” for building out BDD test cases. You can define the test scenario descriptions with a "Given-When-Then" structure in a feature file, as well as a simple setup for mimicking the common endpoints such as Kafka, AMQP, JMS, REST… etc.  


Feature: integration runs


  Background:

    Given load variables namespace.properties

    Given URL: http://camel-hello-quarkus.${namespace}.svc.cluster.local:8080


  Scenario: Checking GET Method

    When send GET /prescription?profileid=123456

    Then verify HTTP response body: {"profileid": 123456, "pharmancy": "CVS" }

    Then receive HTTP 200 OK



I have also been using a spinoff project from Citrus called YAKs to do my BDD testing on Kubernetes(OpenShift) platform. And I LOVED it. Simply because 1st, the lifecycle of the test was managed by the YAKs operator, meaning the test was run on a separate instance, that is where the client supposed the call, and also the YAKs operator takes in the feature, and does the test based on it. You can run it separately or plug it into your CI/CD pipeline.





Platform

I have been using OpenShift(Kunerenets) for managing all the running instances. It's just easier when there are hundreds of Camels running, it manages the scaling, resources, configuration and load-balancing for me. As well as a better deployment module (images). There are so many articles out there talking about the benefits of running a container & container management, so I won’t dive into it. 


CI/CD

Jenkin was on my list for a long time when it comes to building the pipeline for my Camel application. Basically using the maven jenkins plugin for compiling and deploying, and using the OpenShift plugin to do the canary releases. And recently, I have been using the Tekton pipeline, it’s built-in on OpenShift, so there is no need to install a separate instance and manage it. The Kubernetes platform itself will become the CI/CD platform itself. Here is an example of how it works with the Camel projects. I will write another deep dive into how it works.





Monitoring

With Camel 3, in order to collect and export the metrics, you will need to specifically add the microprofile-metrics dependency. And by using Prometheus to scrape metrics on the platform. It stores all scraped samples locally and aggregate the time series data. I then use Grafana to visualize the collected data, and create a dashboard to monitor all the camel routes.




Also checkout this video and see how things work:




Comments

Packers And Movers Delhi Get Shifting/Relocation
Quotation from ###Packers and Movers Delhi. Packers and Movers Delhi 100% Affordable and Reliable
***Household Shifting Services. Compare Transportation Charges and Save Time, ???Verified and Trusted Packers
and Movers in Delhi, Cheap and Safe Local, Domestic House Shifting @ Air Cargo Packers & Logistics
#PackersMoversDelhi Provides Packers and Movers Delhi, Movers And Packers Delhi, Local Shifting, Relocation,
Packing And Moving, Household Shifting, Office Shifting, Logistics and Transportation, Top Packers Movers, Best
Packers And Movers Delhi, Good Movers And Packers Delhi, Home Shifting, Household Shifting, Best Cheap Top
Movers And Packers Delhi, Moving and Packing Shifting Services Company.
To play out the activation process you simply need a Primevideo.com/mytv account, where you can make a record on the Prime video in the event that you have not bought in to watch the Prime video. Keep in mind, you may likewise profit the great video of the I month preliminary membership. How about we discover the essential advances which will assist you with making the great video account.
Read more…

Popular posts from this blog

Red Hat Fuse - Announcing Fuse 7 Tech preview 3 release.

Red Hat Fuse 7.0 technical preview three is out today! On the pathway to become one of the best cloud-native integration platform, Fuse gives developer freedom to choose how they want to develop the integration solution, where they want to deploy it and capabilities to address new integration personas that do not have development experience. By supporting the three major runtime , developer is free to work on the runtime of their choice. By supporting  standalone and cloud deployment , it simplifies the complexity to distinguish between these environments, allowing application to deploy freely among the environment of your choice.  All levels of developers are welcome, you can either dive deep into creating customize complex integration logic , or using the new low code platform to quickly build a simple integration. In this Tech Preview release you get it all. Fuse Standalone Spring-boot for microservice Karaf 4 for OSGi lover JBoss EAP for JavaEE developers Fuse on Op

JBoss EAP 6 - 效能調校 (一) DataSource 的 Connection Pool

效能沒有什麼Best Practice, 反正能調整的就那些。 通常,一個程式的效能大概有70-80% 都跟程式怎麼寫的其實比較有關係。 最近我最疼愛的小貓Puji 因為膀胱結石開刀的時候過世了,心情很差請原諒我的口氣沒有很好,也沒有心情寫部落格。 Puji R.I.P. =======================正文======================= 這個題目很多人叫我寫,可是這題目好大,這分明就是整死我咩~ 所以我會分幾段慢慢寫。 JBoss 的 Subsystem Datasource  Web Web Service  EJB  Hibernate  JMS JCA JVM 調校 OS (作業系統) 先來看一下 DataSource Subsystem, DataSource 的部分主要是針對Connection Pool 做調校。 通常,程式都會需要跟資料庫界接,電腦在本機,尤其是在記憶體的運算很快,但是一旦要外部的資源連接,就是會非常的耗資源。所以現在的應用程式伺服器都會有個Pool 放一些先連接好的 資料庫connection,當程式有需要的時候就可以馬上提供,而不用花那些多餘的資源去連接資料庫。 這就是為什麼要針對Connection Pool 去做調校。 以下會討論到的參數,都是跟效能比較有關係,Datasource 還有很多參數,像是檢核connection 是否正確的,我都不會提到。如果你追求的是非常快速的效能,那我建議你一個檢核都不要加。當然,這樣就會為伺服器上面執行的程式帶來風險。這就是你要在效能與正確,安全性上面的取捨了。 (套句我朋友說的話,不可能又要馬兒好,又要馬兒不吃草的..) 最重要的調校參數就是 Connection 的 Pool 數量。(也就是那個Pool 裡面要放幾條的connection.) 這個參數是每一個應用程式都不一樣的。 min-pool-size  Connection Pool 最少會存留的connection 數量 max-pool-size  Connection Pool 最多可以開啓的 connection 數量 prefill 事先將connection pool 裡面建立好mi

JBoss Fuse - Fuse workshop 101 - Part One

On my way to Hong Kong for a day of workshop on JBoss Fuse, and as I go through my Slide deck, I cannot find any decent easy workshop for beginners. Therefore I decide make a workshop that is easy for Camel first timer to get their hands dirty. The first of part of the workshop is an introduction to Camel, it first goes through what is exactly inside JBoss Fuse. For part one of the workshop, it takes your through the very basic of Camel, one of the very important component inside JBoss Fuse. Every Camel need to have a runtime container to run in, inside camel we call it a CAMEL CONTEXT.  Inside every Camel context, you can define lots of camel route and registry, don't worry about what those are, we will explain later. So inside out blueprint xml, you will see a tag called camelContext. Next up is camel route, they are a chain of command or process defined by you, as a developer. Inside the camel route, there are consumer endpoints that listens to the incoming mess