Package org.apache.camel
Interface Endpoint
- All Superinterfaces:
AutoCloseable
,ComponentAware
,IsSingleton
,Service
- All Known Subinterfaces:
ApiEndpoint
,AsyncEndpoint
,BrowsableEndpoint
,DelegateEndpoint
,InterceptSendToEndpoint
An endpoint implements the
Message Endpoint pattern and represents an endpoint that
can send and receive message exchanges
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configureExchange
(Exchange exchange) Configures a newly createdExchange
.void
configureProperties
(Map<String, Object> options) Configure properties on this endpoint.Creates a new producer which is used send messages into the endpoint Important: Do not do any initialization in the constructor of theProducer
.createConsumer
(Processor processor) Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor Important: Do not do any initialization in the constructor of theConsumer
.Create a new exchange for communicating with this endpoint.createExchange
(ExchangePattern pattern) Create a new exchange for communicating with this endpoint with the specifiedExchangePattern
such as whether its going to be anExchangePattern.InOnly
orExchangePattern.InOut
exchangeCreates a new Polling Consumer so that the caller can poll message exchanges from the consumer usingPollingConsumer.receive()
,PollingConsumer.receiveNoWait()
orPollingConsumer.receive(long)
whenever it is ready to do so rather than using the Event Based Consumer returned bycreateConsumer(Processor)
Important: Do not do any initialization in the constructor of thePollingConsumer
.Creates a new producer which is used send messages into the endpoint.Returns the context which created the endpointdefault String
Returns the string representation of the base endpoint URI (without query parameters).Returns a string key of this endpoint.Returns the string representation of the endpoint URIReturns the default exchange pattern to use when creating an exchange.boolean
Should all properties be known or does the endpoint allow unknown options?default boolean
isRemote()
Whether this endpoint can connect to remote system, such as cloud providers, messaging brokers, databases.default boolean
Whether this endpoint creates singleton producersvoid
setCamelContext
(CamelContext context) Sets the camel context.Methods inherited from interface org.apache.camel.ComponentAware
getComponent, getComponent, setComponent
Methods inherited from interface org.apache.camel.IsSingleton
isSingleton
-
Method Details
-
getEndpointUri
String getEndpointUri()Returns the string representation of the endpoint URI- Returns:
- the endpoint URI
-
getExchangePattern
ExchangePattern getExchangePattern()Returns the default exchange pattern to use when creating an exchange. -
getEndpointBaseUri
Returns the string representation of the base endpoint URI (without query parameters). -
getEndpointKey
String getEndpointKey()Returns a string key of this endpoint. This key is used byLifecycleStrategy
when registering endpoint. This allows to register different instances of endpoints with the same key. For JMX mbeans this allows us to use the same JMX Mbean for all endpoints that are logical the same but have different parameters. For instance the http endpoint.- Returns:
- the endpoint key
-
createExchange
Exchange createExchange()Create a new exchange for communicating with this endpoint. Important: Consumers should useConsumer.createExchange(boolean)
to create an exchange for which the consumer received a message.- Returns:
- a new exchange
-
createExchange
Create a new exchange for communicating with this endpoint with the specifiedExchangePattern
such as whether its going to be anExchangePattern.InOnly
orExchangePattern.InOut
exchange Important: Consumers should useConsumer.createExchange(boolean)
to create an exchange for which the consumer received a message.- Parameters:
pattern
- the message exchange pattern for the exchange- Returns:
- a new exchange
-
configureExchange
Configures a newly createdExchange
.- Parameters:
exchange
- the new exchange
-
getCamelContext
CamelContext getCamelContext()Returns the context which created the endpoint- Returns:
- the context which created the endpoint
-
createProducer
Creates a new producer which is used send messages into the endpoint. Important: Do not do any initialization in the constructor of theProducer
. Instead useBaseService.doInit()
orBaseService.doStart()
.- Returns:
- a newly created producer
- Throws:
Exception
- can be thrown
-
isSingletonProducer
default boolean isSingletonProducer()Whether this endpoint creates singleton producers -
createAsyncProducer
Creates a new producer which is used send messages into the endpoint Important: Do not do any initialization in the constructor of theProducer
. Instead useBaseService.doInit()
orBaseService.doStart()
.- Returns:
- a newly created producer
- Throws:
Exception
- can be thrown
-
createConsumer
Creates a new Event Driven Consumer which consumes messages from the endpoint using the given processor Important: Do not do any initialization in the constructor of theConsumer
. Instead useBaseService.doInit()
orBaseService.doStart()
.- Parameters:
processor
- the given processor- Returns:
- a newly created consumer
- Throws:
Exception
- can be thrown
-
createPollingConsumer
Creates a new Polling Consumer so that the caller can poll message exchanges from the consumer usingPollingConsumer.receive()
,PollingConsumer.receiveNoWait()
orPollingConsumer.receive(long)
whenever it is ready to do so rather than using the Event Based Consumer returned bycreateConsumer(Processor)
Important: Do not do any initialization in the constructor of thePollingConsumer
. Instead useBaseService.doInit()
orBaseService.doStart()
.- Returns:
- a newly created pull consumer
- Throws:
Exception
- if the pull consumer could not be created
-
configureProperties
Configure properties on this endpoint.- Parameters:
options
- the options (properties)
-
setCamelContext
Sets the camel context.- Parameters:
context
- the camel context
-
isLenientProperties
boolean isLenientProperties()Should all properties be known or does the endpoint allow unknown options? lenient = false means that the endpoint should validate that all given options is known and configured properly. lenient = true means that the endpoint allows additional unknown options to be passed to it but does not throw a ResolveEndpointFailedException when creating the endpoint. This options is used by a few components for instance the HTTP based that can have dynamic URI options appended that is targeted for an external system. Most endpoints is configured to be not lenient.- Returns:
- whether properties is lenient or not
-
isRemote
default boolean isRemote()Whether this endpoint can connect to remote system, such as cloud providers, messaging brokers, databases. A local endpoint operates locally only, such as an internal message transformer, logger, or such as direct/seda components.
-