public abstract class DefaultEndpoint
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.Endpoint, org.apache.camel.spi.HasId, org.apache.camel.CamelContextAware
Endpoint
.Modifier | Constructor and Description |
---|---|
protected |
DefaultEndpoint()
Constructs a partially-initialized DefaultEndpoint instance.
|
protected |
DefaultEndpoint(String endpointUri,
org.apache.camel.Component component)
Constructs a fully-initialized DefaultEndpoint instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureConsumer(org.apache.camel.Consumer consumer) |
void |
configureExchange(org.apache.camel.Exchange exchange) |
protected void |
configurePollingConsumer(org.apache.camel.PollingConsumer consumer) |
void |
configureProperties(Map<String,Object> options) |
org.apache.camel.AsyncProducer |
createAsyncProducer() |
protected String |
createEndpointUri()
A factory method to lazily create the endpointUri if none is specified
|
org.apache.camel.Exchange |
createExchange() |
org.apache.camel.Exchange |
createExchange(org.apache.camel.ExchangePattern pattern) |
org.apache.camel.PollingConsumer |
createPollingConsumer() |
protected void |
doInit() |
protected void |
doStart() |
protected void |
doStop() |
boolean |
equals(Object object) |
org.apache.camel.CamelContext |
getCamelContext() |
org.apache.camel.Component |
getComponent()
Returns the component that created this endpoint, or null if none set.
|
String |
getEndpointKey() |
String |
getEndpointUri() |
org.apache.camel.spi.ExceptionHandler |
getExceptionHandler() |
org.apache.camel.ExchangePattern |
getExchangePattern() |
String |
getId()
Returns a unique String ID which can be used for aliasing without having to use the whole URI which is not unique
|
long |
getPollingConsumerBlockTimeout() |
int |
getPollingConsumerQueueSize() |
int |
hashCode() |
boolean |
isAutowiredEnabled() |
boolean |
isBridgeErrorHandler() |
boolean |
isLazyStartProducer() |
boolean |
isLenientProperties() |
boolean |
isPollingConsumerBlockWhenFull() |
boolean |
isPollingConsumerCopy() |
boolean |
isSingleton()
An endpoint should favour to be singleton by default, only in some rare special cases can an endpoint be
non-singleton.
|
void |
setAutowiredEnabled(boolean autowiredEnabled)
Whether autowiring is enabled.
|
void |
setBridgeErrorHandler(boolean bridgeErrorHandler)
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by
the routing Error Handler.
|
void |
setCamelContext(org.apache.camel.CamelContext camelContext) |
void |
setComponent(org.apache.camel.Component component) |
protected void |
setEndpointUri(String endpointUri)
Sets the URI that created this endpoint.
|
void |
setEndpointUriIfNotSpecified(String value)
Sets the endpointUri if it has not been specified yet via some kind of dependency injection mechanism.
|
void |
setExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler)
To let the consumer use a custom ExceptionHandler.
|
void |
setExchangePattern(org.apache.camel.ExchangePattern exchangePattern)
Sets the default exchange pattern when creating an exchange.
|
void |
setLazyStartProducer(boolean lazyStartProducer)
Whether the producer should be started lazy (on the first message).
|
void |
setPollingConsumerBlockTimeout(long pollingConsumerBlockTimeout)
Sets the timeout in millis to use when adding to the internal queue off when
EventDrivenPollingConsumer
is being used. |
void |
setPollingConsumerBlockWhenFull(boolean pollingConsumerBlockWhenFull)
Set whether to block when adding to the internal queue off when
EventDrivenPollingConsumer is being used. |
void |
setPollingConsumerCopy(boolean pollingConsumerCopy)
Sets whether to copy the exchange when adding to the internal queue off when
EventDrivenPollingConsumer
is being used. |
void |
setPollingConsumerQueueSize(int pollingConsumerQueueSize)
Sets the
PollingConsumer queue size, when EventDrivenPollingConsumer is being
used. |
void |
setProperties(Object bean,
Map<String,Object> parameters)
Sets the bean properties on the given bean.
|
String |
toString() |
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
createConsumer, createProducer, getEndpointBaseUri, isSingletonProducer
protected DefaultEndpoint(String endpointUri, org.apache.camel.Component component)
endpointUri
- the full URI used to create this endpointcomponent
- the component that created this endpointprotected DefaultEndpoint()
createEndpointUri()
if
one uses this constructor.
Note: It is preferred to create endpoints using the associated component.public String getId()
getId
in interface org.apache.camel.spi.HasId
public String getEndpointUri()
getEndpointUri
in interface org.apache.camel.Endpoint
public String getEndpointKey()
getEndpointKey
in interface org.apache.camel.Endpoint
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
getCamelContext
in interface org.apache.camel.Endpoint
public org.apache.camel.AsyncProducer createAsyncProducer() throws Exception
createAsyncProducer
in interface org.apache.camel.Endpoint
Exception
public org.apache.camel.Component getComponent()
public void setComponent(org.apache.camel.Component component)
public void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext
in interface org.apache.camel.CamelContextAware
setCamelContext
in interface org.apache.camel.Endpoint
public org.apache.camel.PollingConsumer createPollingConsumer() throws Exception
createPollingConsumer
in interface org.apache.camel.Endpoint
Exception
public org.apache.camel.Exchange createExchange()
createExchange
in interface org.apache.camel.Endpoint
public org.apache.camel.Exchange createExchange(org.apache.camel.ExchangePattern pattern)
createExchange
in interface org.apache.camel.Endpoint
public void configureExchange(org.apache.camel.Exchange exchange)
configureExchange
in interface org.apache.camel.Endpoint
public org.apache.camel.ExchangePattern getExchangePattern()
getExchangePattern
in interface org.apache.camel.Endpoint
public void setExchangePattern(org.apache.camel.ExchangePattern exchangePattern)
public boolean isAutowiredEnabled()
public void setAutowiredEnabled(boolean autowiredEnabled)
public boolean isLazyStartProducer()
public void setLazyStartProducer(boolean lazyStartProducer)
public boolean isBridgeErrorHandler()
public void setBridgeErrorHandler(boolean bridgeErrorHandler)
public org.apache.camel.spi.ExceptionHandler getExceptionHandler()
public void setExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler)
public int getPollingConsumerQueueSize()
public void setPollingConsumerQueueSize(int pollingConsumerQueueSize)
PollingConsumer
queue size, when EventDrivenPollingConsumer
is being
used. Notice some Camel components may have their own implementation of PollingConsumer
and therefore not using the default EventDrivenPollingConsumer
implementation.
The default value is 1000public boolean isPollingConsumerBlockWhenFull()
public void setPollingConsumerBlockWhenFull(boolean pollingConsumerBlockWhenFull)
EventDrivenPollingConsumer
is being used.
Notice some Camel components may have their own implementation of PollingConsumer
and
therefore not using the default EventDrivenPollingConsumer
implementation.
Setting this option to false, will result in an IllegalStateException
being thrown
when trying to add to the queue, and it is full.
The default value is true which will block the producer queue until the queue has space.public long getPollingConsumerBlockTimeout()
public void setPollingConsumerBlockTimeout(long pollingConsumerBlockTimeout)
EventDrivenPollingConsumer
is being used.setPollingConsumerBlockWhenFull(boolean)
public boolean isPollingConsumerCopy()
public void setPollingConsumerCopy(boolean pollingConsumerCopy)
EventDrivenPollingConsumer
is being used.
Important: When copy is enabled then the unit of work is handed over from the current exchange to the
copied exchange instance. And therefore its the responsible of the PollingConsumer
to done the unit of
work on the received exchanges. When the polled exchange is no longer needed then MUST call
UnitOfWork.done(Exchange)
.
Default is false to not copy.public void configureProperties(Map<String,Object> options)
configureProperties
in interface org.apache.camel.Endpoint
public void setProperties(Object bean, Map<String,Object> parameters)
DefaultComponent.setProperties(Object, java.util.Map)
bean
- the beanparameters
- properties to setprotected String createEndpointUri()
public void setEndpointUriIfNotSpecified(String value)
protected void setEndpointUri(String endpointUri)
public boolean isSingleton()
isSingleton
in interface org.apache.camel.IsSingleton
public boolean isLenientProperties()
isLenientProperties
in interface org.apache.camel.Endpoint
protected void configureConsumer(org.apache.camel.Consumer consumer) throws Exception
Exception
protected void configurePollingConsumer(org.apache.camel.PollingConsumer consumer) throws Exception
Exception
protected void doInit() throws Exception
doInit
in class org.apache.camel.support.service.BaseService
Exception
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.service.BaseService
Exception
Apache Camel