Top 34 Apache Camel Interview Questions
Q1. Have You Used Apache Camel With Spring?
Yes. Have integrated Apache Camel with Spring. It helps in utilizing capabilities like Spring Dependency injection, Datasource and Traction control.
Q2. What Are Components?
In simple phrases, a element refers to an external entity that is speaking with camel. To write a camel course that paintings with documents, record issue is to be used. Similarly to paintings with JMS queue, jms issue has for use.
Ex – A FileComponent is referred to by using file in a URI and it creates FileEndpoints.
Q3. What Is Camelcontext?
The CamelContext represents a single Camel routing rulebase. We use the CamelContext in a similar manner to the Spring ApplicationContext. Public interface CamelContext extends SuspendableService, RuntimeConfiguration. Interface used to symbolize the context used to configure routes and the rules to apply in the course of message exchanges between endpoints.
Q4. How Is A Camel Exchange Created?
An change is created by the endpoint.
Q5. What Is Camel ?
At a totally abstract degree, camel can be introduced as a routing engine. Camel allows us to define our routing rules to direction messages from unique source to vacation spot.
Camel presents in-built help for plenty protocols which makes it easy for us to integrate extraordinary systems.
For ex: Camel can easily combine two exceptional programs running in ftp and jms respectively. Internally Camel performs all the required protocol and datatype conversions for us.
Q6. Have You Used Apache Camel With Spring Boot?
Have incorporated Apache Camel with Spring Boot. Made use of Apache Camel Spring Boot starter dependency. Apache Camel + Spring Boot
Q7. What Platforms Are Supported?
Any platform assisting JDK 6.
We frequently take a look at Camel on Linux, Windows and OS X.
Q8. What Are The Dependencies?
Camel 2.6 or older can run on JDK 1.5 or better.
Camel 2.7 onwards requires JDK 1.6 or JDK 1.7.
Camel 2.14 onwards requires JDK 1.7 or higher.
Camel 2.18 onwards calls for JDK 1.8.
Q9. Is Camel An Esb?
Typically companies declare practically everything is an ESB in recent times, so the wer might be sure (smile)
However our view is that an ESB is greater of a box of integration components, so we view Apache ServiceMix to be a real ESB primarily based round OSGi (and optionally JBI) to offer a standards based totally integration platform of components.
We view Camel as being a rule primarily based routing & mediation engine which may be used internal a complete blown ESB, a message broking or an internet offerings smart purchaser. Though if you need to, you may do not forget that Camel is a small, light-weight embeddable ESB given that it could provide a number of the not unusual ESB offerings like clever routing, trformation, mediation, monitoring, orchestration and so on.
Q10. What Is Routercontext?
It is now possible to outline routes outside <camelContext/> which you do in a brand new <routeContext/> tag. The routes defined in <routeContext/> may be reused through more than one <camelContext/>. However its handiest the definition which is reused. At runtime each CamelContext will create its very own example of the direction primarily based on the definition.
Q11. What Jars Do I Need?
Camel is designed to be small light-weight and extraordinarily modular so that you handiest pay for what you use. The center of camel, camel-middle.Jar is small and has minimum dependencies.
On Java 6 camel-middle.Jar best relies upon on
commons-management.Jar (for Camel 2.Eight or older)
commons-logging.Jar (for Camel 2.6 or older)
slf4j-api.Jar (from Camel 2.7 onwards)
On Java 5 camel-center.Jar relies upon also on activation.Jar and a JAXB2 implementation which commonly entails jaxb-api.Jar, jaxb-impl.Jar and a StAX API which can be stax-api.Jar and *woodstox.Jar
Q12. How Is Data Passed Between The Routes?
The records is passed inside the routes as an item of the magnificence org.Apache.Camel.Exchange.
Q13. What Is An Endpoint?
A camel endpoint is just like an entity this is able to sending or receiving messages. For e.G., a JMS queue may be dealt with as an endpoint.
Q14. How Did You Execute Junit Test Cases For Apache Camel?
Using CamelSpringTestSupport - Apache Camel Unit Testing
Q15. What Are Different Message Exchange Patterns In Camel, Which One Of These Is Synchronous?
There are two kinds of message alternate styles in Camel:
In Only: In this change pattern, purchaser creates a change which handiest contains an In message.
In Out: In this change sample, customer creates a alternate which also consists of respond message for the caller.
Out of above two, InOut pattern is synchronous because caller expects for an acknowledgement or reply for every exchange despatched.
Q16. What Is A Producer And A Consumer Endpoint?
A camel direction is much like a channel although which information flows. Producer and purchaser are endpoints which can be gift at every quit of the channel.
A patron endpoint is the start line of the direction. A definition of a camel course begins by means of writing a camel client endpoint.
A manufacturer endpoint seems (no longer always) at the quit of the path. It consumes the records this is passed via the route.
Q17. What Is Redelivery Policy In Apache Camel?
A redelivery coverage defines policies while Camel Error Handler carry out redelivery tries. For instance you may setup regulations that state how generally to attempt redelivery, and the put off in between attempts, and so forth.
Q18. How Are Exception Handled Using Apache Camel?
Exception may be treated the use of the <try> <catch> block, <OnException> block or the <errorHandler> block.
The errorHandler is used to handle any uncaught Exception that gets thrown all through the routing and processing of a message. Conversely, onException is used to address particular Exception types while they may be thrown.
Q19. What Is Camel Exchange? Explain Its Structure?
A Camel Exchange can be called as an holder for holding message for the duration of routing. A trade helps diverse message alternate patterns, like InOnly and InOut.
Following are the contents of camel change:
ExchangeId: A precise identifier for each exchange
Message Exchange Pattern: This discipline denotes whether you're using InOnly or InOut exchange pattern.
Exception: If any exception occurs for the duration of routing, it will likely be to be had in this area.
Properties: These are the homes which might be to be had for entire duration of trade.
In Message: This is mandatory discipline which contains the input message.
Out Message: This is optionally available message which exists most effective if MEP is InOut.
Q20. What Is An Exchange In Apache Camel?
The message to be routed in Camel course is gift in the Exchange. It is the message holder. Apache camel makes use of Message Exchange Patterns(MEP). Apache camel exchange can keep any kind of message. It helps a spread of formats like xml, JSON and so forth.
Q21. What Is An Esb? Have You Deployed Camel On Any Esb?
ESB stands for Enterprise Service Bus. It can be defined as a tool designed to help put into effect an application using SOA concepts Not for all projects tasks is the usage of ESB an most reliable answer ESB must be used while initiatives contain integrating some of Endpoints like Webservices, JMS, FTP etc. Have deployed JBoss Fuse ESB for Apache Camel Deployement.
Q22. Can We Call Camel An Esb (business enterprise Service Bus)?
Although camel supports many functions just like ESB like routing, trformation and many others., we can not call camel as ESB because it does not have a box like ESBs. However, we can installation camel on to some ESB box like carrier mix.
Q23. What Type Of Object(s) Can The Exchange Hold?
A camel Exchange can hold any sub sort of java.Lang.Object including primitive facts kinds.
Q24. What Are Various Components In Apache Camel? Which Ones Have You Used?
Apache camel provides us with a number of components. These additives make interacting create endpoints with which a gadget can engage with other outside systems. For instance the usage of an ActiveMQ aspect we reveal an ActiveMQ endpoint for interplay with outside system. There are greater than 100 components furnished by using Apache Camel. Some of them are FTP,JMX, Webservices, HTTP. Apache camel additionally lets in customers to create custom additives.
Here are examples of FileComponent, JMSComponent, CXF Component.
Q25. What Is An Uri?
URI is a naming scheme utilized in camel to consult an endpoint. An URI tells camel, the factor being used, the context path and the options applied in opposition to the element. URI carries 3 parts:
Scheme
Context course
Options
Example of a file URI running as a client :
from("document:src/facts?FileName=demo.Txt&fileExist=Append");
Here the scheme factors to file, the context route is “src/statistics” and the options are “fileName and fileExist” are alternatives that can be used with document element or file endpoint.
Q26. What Is A Router?
We regularly speak about that Camel is a mediation and routing framework; so what precisely is a router and what does it do?
Basically a router simply consumes Message exchanges from a few Endpoint, then sends them directly to a few different Endpoint the usage of a few kind of Enterprise Integration Patterns.
For instance a router ought to enforce the Content Based Router sample, to direction from an endpoint to 1 or greater destination endpoints using a Predicate based totally on the message content.
Typically a path or router consists of one or extra consumers; either an Event Driven Consumer or a Polling Consumer or likely a Tractional Client. Then there are one or greater Processor instances that may ship the message to 1 or more endpoints.
Q27. What Are Routes In Apache Camel?
The center functionality of Apache Camel is its routing engine. It allocates messages primarily based at the associated routes. A direction contains drift and integration good judgment. It is carried out the usage of EIPs and a specific DSL.
Q28. What Are Dsls And Which Dsls Have You Used?
Routes in a variety of domain-specific languages (DSL).The maximum famous ones are Java DSL - A Java based DSL using the fluent builder style. Spring XML - A XML primarily based DSL in Spring XML files.
Q29. How Did You Integrate Apache Camel With Database?
Using Apache Camel SQL component.
Apache Camel + SQL thing(MySQL DB)
Q30. What Is The License?
This software program is open supply using the Apache 2.0 licence (a liberal BSD fashion license which is very commercial friendly)
Q31. Why You Selected Camel For Your Application Or Why You Use Camel?
Camel could be very light-weight routing engine that lets in us to combine one-of-a-kind programs with minimal configuration. Inbuilt assist for specific protocols lets in a developer to awareness on enterprise problem than on integration problem. Camel routing isn't confined to xml payload however it is able to route any sort of message. Camel check package in addition helps to check the solution.
Q32. Have You Exposed A Webservice Endpoint Using Apache Camel?
Yes. Using Apache CXF uncovered a webservice to be ate up. Used Contract first approach to generate the classes from wsdl.
Q33. Have You Use Database With Apache Camel?
Yes. Have incorporated Apache Camel MySQL Database using SQL Queries
Q34. What Are Endpoints In Apache Camel?
Camel helps the Message Endpoint pattern the usage of the Endpoint interface. Endpoints are usually created with the aid of a Component and Endpoints are normally noted in the DSL thru their URIs.
