Integration / Apache Camel Interview Questions
What is an Endpoint in Camel and how does the URI format work (scheme:path?options)?
An Endpoint is a communication channel that abstracts a specific transport behind a uniform interface. Every endpoint is identified by a URI: scheme:path?option1=value1. The scheme identifies the Component factory, the path is the component-specific address, and options configure behaviour as query parameters.
// File: poll dir every 2s, leave files untouched
from("file:/data/input?noop=true&delay=2000")
// JMS: produce with client acknowledgement
.to("jms:queue:invoices?acknowledgementModeName=CLIENT_ACKNOWLEDGE")
// HTTP: outbound call with 30s connect timeout
.to("http://api.example.com/products?bridgeEndpoint=true&connectTimeout=30000");
// Kafka: consume from earliest offset
from("kafka:payments?brokers=localhost:9092&autoOffsetReset=earliest");
// Timer: fire every 10s starting immediately
from("timer:heartbeat?period=10000&delay=0");An endpoint can be a Consumer (in from()) or Producer (in to()). The timer: component is consumer-only; log: is producer-only; jms: and kafka: support both. Endpoints are cached by the CamelContext — the same URI reuses the same instance. Property placeholders ({{key}}) keep environment-specific values out of code.
More Related questions...