Package org.apache.camel
Interface Consumer
- All Superinterfaces:
AutoCloseable
,EndpointAware
,Service
- All Known Subinterfaces:
BatchConsumer
,PollingConsumer
A consumer of message exchanges from an
Endpoint
.
Important: Do not do any initialization in the constructor. Instead use
BaseService.doInit()
or
BaseService.doStart()
.-
Method Summary
Modifier and TypeMethodDescriptioncreateExchange
(boolean autoRelease) Creates anExchange
that was consumed.default AsyncCallback
defaultConsumerCallback
(Exchange exchange, boolean autoRelease) The default callback to use with the consumer when calling the processor using asynchronous routing.The processor that will process theExchange
that was consumed.void
releaseExchange
(Exchange exchange, boolean autoRelease) Releases theExchange
when its completed processing and no longer needed.Methods inherited from interface org.apache.camel.EndpointAware
getEndpoint
-
Method Details
-
getProcessor
Processor getProcessor()The processor that will process theExchange
that was consumed. -
createExchange
Creates anExchange
that was consumed. Important: If the auto release parameter is set to false then the consumer is responsible for calling thereleaseExchange(Exchange, boolean)
when theExchange
is done being routed. This is for advanced consumers that need to have this control in their own hands. For normal use-cases then a consumer can use autoRelease true and then Camel will automatic release the exchange after routing.- Parameters:
autoRelease
- whether to auto release the exchange when routing is complete viaUnitOfWork
-
releaseExchange
Releases theExchange
when its completed processing and no longer needed.- Parameters:
exchange
- the exchangeautoRelease
- whether the exchange was created with auto release
-
defaultConsumerCallback
The default callback to use with the consumer when calling the processor using asynchronous routing. This implementation will useExceptionHandler
to handle any exception on the exchange and afterwards release the exchange.- Parameters:
exchange
- the exchangeautoRelease
- whether the exchange was created with auto release- Returns:
- the default callback
-