What is the CamelContext in apache? - apache-camel

I searched in web but did not find any explanation that what is the exactly CamelContext? where and how to use ?
I gone through below links also but not satisfied with explanation.
https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html
https://dzone.com/articles/apache-camel-tutorial-eip
There are many comparision for CamelContext with others, but what I am looking for is the what is it? I want some conceptual explanation.
Please help me to understand this.

It's roughly an instance of a Camel environment, or at least it's a reference to it. Most apps would only have one CamelContext, but you can have several if needed. Looking at the referenced document, it shows how the context has a lifecycle.
In most cases, the context will start and stop along with the application.

After seeing the videos in YouTube, I knew about the Apache camel framework,
and from that I got the answer that camelcontext is nothing but context of the 'apache camel framework' framework.
As many framework have context like Spring have an applicationcontext, Ninja have a context, same the 'Apache camel framework' have a context and that is called 'camelcontext'.
So, it is the run-time system of Apache Camel (framework) and it connects its different concepts such as routes, components or endpoints.
Reference :
Basic Apache Camel Tutorial

Related

using reactive-streams with Apache Camel Saga

I would like to know if it is possible to use reactive streams in Apache Camel. I know reactive-streams is a component from Apache but I couldn't get it to work the way they explain in the documentation. I would like to know if there is any possible solutions available in github that could help me understand apache camel along with reactive-streams except the one's from apache.
I could possibly use Producer Template with reactor-core but the route logic that sits in RouteBuilder configure method would still be blocking I/O. Any helps would be appreciated?

Any examples on how to use the Camel's BacklogDebugger?

Well, I decided to hack my own IDEA debugger plugin for Apache Camel. I found some info about the BacklogDebugger feature, but I guess I don't really understand how to use it. What puzzles me is how do I get any notification of the breakpoint reached in the running Camel application. Is there any way to add event listeners to the BacklogDebugger? Or is there any other feature for that?
I couldn't find any examples of how the BacklogDebugger is used.
The Hawtio Camel plugin uses BacklogDebugger for its Camel route debugging page.
It polls the getDebugCounter method to see if there are any new debugged messages and from there it figures out if any breakpoints were hit and retrieves the message exchange content.
You can try to decipher the TypeScript code for inspiration:
https://github.com/hawtio/hawtio-integration/blob/master/plugins/camel/ts/debug/debug.controller.ts
The Eclipse Desktop Fuse Tooling is also using it. As it is written in Java, it migth be easier to translate for IntelliJ IDEA plugin.
See https://github.com/jbosstools/jbosstools-fuse/tree/jbosstools-4.21.0.Final/editor/plugins/org.fusesource.ide.launcher/src/org/fusesource/ide/launcher/debug

Can I use Camel and WMQ without JMS?

I am currently learning Camel, and have a specific project in mind that requires a Websphere MQ back-end, but I can't use JMS components, since I need a lot of non-jms headers, like MQIIH.
I found the camel-wmq project.
Is it the recommended solution ? Is it any good ?
You don't need to use jms. WMQ has a client API. Just download the wmq client jars and put them in your project and use them together with your Camel routes. You will probably put the wmq client code in a processor class or something similar. Off course best to test to put a message on a queue manually via RFHUTIL or something similar as a client so you are sure the environment setup is correct.
The suggested way of working with WMQ has always been through the JMS component since it enables you to painlessly switch to other providers if the need arises.
However, if you need to use some WMQ-specific function then my suggestion would be to extend the camel-wmq library - it contains only a subset of features supported by WMQ and does not support MQIIH headers that you need. Adding functionality to a component would probably involve more work than the solution Souciance Eqdam Rashti suggested but it would be a cleaner solution and more in line with Camel's philosophy. Also, you'd be giving back to the community and thus help make Camel a better tool for everyone :)
I would also suggest you go through the IBM MQ discussions on the Camel's official user group mailing list and see if you can salvage anything.

Difference between processor , component and end point

I am studying Apache Camel.
Could some one please explain the difference between a processor, component and endpoint with regard to Apache Camel.
A component allows you to talk with other systems. It allows you to send or receive messages and encapsulates the protocol to deal with another system. For e.g. jms-component allows to talk with JMS brokers.
An endpoint is nothing but the channel by which you send or receive a message through component e.g. "jms:queue:order" this defines a jms endpoint which is a queue from where your (jms) component will either consume or publish a message.
While a processor is piece of code which goes in between routes. There you write code to manipulate (transform/enrich/extract etc.) the message or have some integration logic.
For more details refer to camel's documentation
All whom are new to Apache Camel I suggest to read this article which explains really well what Camel is, and has an example to go along.
http://java.dzone.com/articles/open-source-integration-apache
Another great piece is chatper 1 of the Camel in Action book, which can be freely downloaded from here: http://www.manning.com/ibsen/Camel_ch01_update.pdf
Disclaimer: I am co-author of that book.
And there is this old by good tutorial that still applies today: http://camel.apache.org/tutorial-example-reportincident.html
And you can find more tutorials / examples on the Camel website
http://camel.apache.org/tutorials.html
http://camel.apache.org/examples.html
And there is also some links to 3rd party blogs/articles/videos about Camel, where you can find some great information:
http://camel.apache.org/articles.html

Is there a Solr-Camel component?

I've been looking for this for a while and haven't found anything yet. Is there any reason to that ? I would like to proxy a solr server with the camel integration framework and I understand it must be quite straight forward without it, but less elegant :).
If someone has worked on this, I would love some feedback.
Nicolas.
yep, there is a new camel-solr component
There is an Apache Lucene component
http://camel.apache.org/lucene
But I dont think anyone has done any Apache Solr component. However in the end its all Java code, so you should be able to leverage them together.
Also check out github as people spin off projects there creating all kind of Camel related components.
There is a camel-solr component proposal https://issues.apache.org/jira/browse/CAMEL-4539
I have build a Camel Solr endpoint as part of a search project. Solr and Camel fits smoothly and I have had no problems. Its available at here. Its still in the early days, i.e. I'm writing the documentation and testing as we speak.
It would be great if you could try it out and provide feedback, both to its usage as well as to the documentation.
Cheers

Resources