apache camel interview questions

Top Frequently Asked Apache Camel Interview Questions

What is Camel ?

Camel is Apache's integration framework.It is open source and target of camel is, to make integration system easier.Using camel we can write routes which provides a facility from which source message should be forwarded to which destination

What is noop=true ?

It is an optional parameter.If this is true it means files from source location will not be moved it will be as is.By making false files from source can be cut and pasted to destination.

What is Message in camel ?

It is an abstract entity in camel which contains data.It also has header and body.

What is Exchange in camel ?

It is a container of message during routing.

What is MEP in camel ?

MEP is message exchange pattern which is used to differentiate messaging style between one way and request/reply.

What is the content of Exchange in camel ?

  • ExchangeId : It uniquely identify Exchange.User can set this value
  • MEP : It will let us know what is message style.It can be one way or request /reply
  • Exception : If there is any exception during routing then this field will contain exception value.
  • Properties : It is global properties that Exchange holds

What is In message in camel ?

It is one way or request message that is mandatory

What is Out message in camel ?

It is request/reply message that is optional

What is CamelContext in camel ?

It is camel runtime system or we can think as it is container that holds all components.

What is default registry in camel ?

JNDI.

What is routes in camel ?

It is an abstraction.It is used to decouple server and client.In other words we can say it is a chain of processor.Every route has its own Id

What is Processor in camel ?

It is responsible for modifying or processing message.

Can we create our own processor ?

Yes , we need to implement Processor class and implement below method.

public class MyProcessor implements org.apache.camel.Processor{

public void process(Exchange exchange) throws Exception{ }

}

What is Component in camel ?

It is a factory of Endpoint for example FileComponet gives FileEndpoints. In Camel there are more than 80 component.

What is EndPoint in camel ?

It is an end of channel and it has three main part.

  • Scheme : It denotes component type.
  • Path : From/to message should be sent.
  • Parameter : Optional parameter like noop=true.

What is difference between event driven consumer an polling consumer in camel ?

Event Driven : Its is asynchronous process where client listens on port or queue to get the message.

polling : In which consumer actively fetches message from queue or port

What is DSL ?

DSL is acronym of Domain Specific Language.It can be many type like Java DSL, Spring DSL, Scala DSL etc

What is CBR EIP in camel ?

CBR is content based routing,in which based on incoming message header or content destination is decided.

What is Multicast EIP in camel ?

In Multicast EIP, a message can be sent to many destination sequentially for example if we pick file from input and wants to send it to two queues (preparationforinterview_1 and preparationforinterview_1) then we can do it by multicast EIP.Syntax to send message in java DSL is

from("file:input?noop=true").multicast().to("jms:preparationforinterview_1", "jms:preparationforinterview_2");

In above example messages are sent first preparationforinterview_1 and after that preparationforinterview_2

How can i send message parallel ?

In Multicast EIP, a message can be sent to many destination in parallel for example if we pick file from input and wants to send it to two queues (preparationforinterview_1 and preparationforinterview_1) in parallel then we can do it by multicast EIP using parallelProcessing() method.

Syntax to send message in java DSL is

from("file:input?noop=true").multicast().parallelProcessing() .to("jms:preparationforinterview_1", "jms:preparationforinterview_2");

In above example messages are sent at the same time to preparationforinterview_1 and preparationforinterview_2

What is the stopOnException() in multicast ?

By default in multicast even if ant routes fails then multicast does not stop sending message to others queue, so to stop muticast to send message on others queue if any queue fails we use stopOnException()

Syntax of stopOnException() in java DSL is

from("file:input?noop=true").multicast().stopOnException() .parallelProcessing() .to("jms:preparationforinterview_1", "jms:preparationforinterview_2");

Syntax of stopOnException in Spring DSL is

<from uri="file:input?noop=true/> <multicast parallelProcessing="true" stopOnException="true"> <to uri="jms:preparationforinterview_1"/> <to uri="jms:preparationforinterview_2"/> </multicast>

What is the difference between multicast and recipient list EIP ?

multicast is static while recipient is dynamic.In mulicast you already knows about destination while in recipient at runtime we decide destination

What is camel registry ?

It is an abstract layer.When a caller wants to look up a bean then it looks up in camel registry first and camel registry looks up it in real registry.Registry in camel is interface and camel provided many implementation that are shipped with camel. for example SimpleRegistry , ApplicationContextRegistry ,JndiRegistry etc

What is default registry in camel ?

JndiRegistry

What is default registry when camel is used with spring ?

ApplicationContextRegistry

Does camel link method invocation of bean at compile time or runtime ?

runtime

How camel handles multiple parameter binding in bean method ?

Using annotation.To get in details with example,go on below link

Camel Bean Parameter Binding Example using Java DSL

What are the error handlers provided by camel ?

Camel provides following error handlers

  • DefaultErrorHandler
  • NoErrorHandler
  • DeadLetterChannel
  • LoggingErrorHandler
  • TransactionErrorHandler

What is the default error handler in camel ?

DefaultErrorHandler

What is the difference between DefaultErrorHandler and DeadLetterChannel error handler in camel ?

DeadLetterChannel error handler moves the failed message to error queue called dead letter queue

How many scope does camel error handler have ?

It has two scopes

  • context
  • route

How to skip particular exception in camel ?

Using continued(true) option.For example if we want to skip ValidationException

onException(ValidationException.class) .continued(true);

What is Stream component in camel ?

Stream component is used to read/write input/output from/to console.

What is codec ?

In TCP world sometime a single message does not reach to destination in single piece. It is broken down in fragment and assemble again at receiver.

What is difference between SEDA and VM component in camel ?

SEDA is used for single CamelContext while VM can be used within JVM and in single VM many CamleContext can be loaded.

What is difference between Aggregator and Splitter EIP ?

  • Splitter : It splits single message into multiple sub messages.
  • Aggregator : It combines multiple sub messages into single message.

They both are opposite.

What is the state of Aggregator EIP stateful or stateless ?

Stateful because aggregator needs to store the in-progress aggregates until message is published.

What is Composed Message Processor Pattern ?

In Composed Message Processor Pattern,a message is split into small messages,process them and again combine them into single aggregate message.

What is difference between routing slip and dynamic router ?

In routing slip we compute the slip up front while in dynamic router we compute route on the fly.

How to copy file from one location to other using java DSL in camel ?

To get example to copy from one location to other,visit below links.

File Copy Example Using Camel

How to copy file from one location to other using java spring DSL in camel ?

To get example to copy from one location to other,visit below links.

File Copy Example In Camel Using Spring



Visit Others Links

Interview Questions Top Elasticsearch Interview Question
Top Kubernetes Interview Question
Top HTTP Interview Question
Top PouchDB Interview Question
Top Pivotal Cloud Foundry (pcf) Interview Question
Top Apache Camel Interview Question
Top Docker Interview Question
Top Gradle Interview Question
Top Generics Interview Questions In Java
Java 9 Interview Questions
Top Maven Interview Question
Top RabbitMQ Interview Question
Top Spring Batch Interview Question
Top Spring Boot Interview Question
Top Tika Interview Question
Top Kotlin Interview Question
Top OpenShift Interview Question
Top Polymer Interview Question
Top WebGL Interview Question
Top Continuous Integration Interview Question
Top Spring Cloud Interview Question
Top JOGL Interview Question
Top JFreeChart Interview Question
Java MultiThreading Interview Question
Top Spring ROO Interview Question
Top Seaborn Interview Question
Top TestRail Interview Question
Top LolCode Interview Question
Top Spring Transaction Management Interview Question
Top DynamoDB Interview Question
Top PySpark Interview Question
Top SaltStack Interview Question
Top Spring AOP Interview Question
© 2019 PreparationForInterview.com