MuleESB / Apache Camel Interview Questions
What are Camel Components and how do you use the Timer, File, HTTP, and JMS components?
A Camel Component is the factory responsible for creating Endpoint instances for a given URI scheme. Over 300 components ship with Camel, discovered automatically via META-INF/services/org/apache/camel/component/ entries. You use a component by referencing its URI scheme in from() or to().
// Timer: trigger a route every 5 seconds
from("timer:heartbeat?period=5000")
.setBody(constant("health-check"))
.to("log:health");
// File: poll directory, move processed files
from("file:/in?move=processed&delay=2000")
.to("file:/out");
// HTTP: outbound POST with JSON body
from("direct:send")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
.to("http://api.example.com/orders");
// JMS: consume from queue, produce to topic
from("jms:queue:orders")
.to("jms:topic:order-events");All four components follow the same URI pattern: scheme:path?options. Timer and File are primarily consumer-only (from()) and producer-only respectively; HTTP and JMS support both roles. Components are thread-safe singletons in the CamelContext; the same instance creates all endpoints for its scheme.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
