public abstract class AbstractApiConsumer<E extends Enum<E> & ApiName,T> extends ScheduledPollConsumer implements PropertyNamesInterceptor, PropertiesInterceptor, ResultInterceptor
Modifier and Type | Field and Description |
---|---|
protected AbstractApiEndpoint<E,T> |
endpoint |
protected org.slf4j.Logger |
log |
protected ApiMethod |
method |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
AbstractApiConsumer(AbstractApiEndpoint<E,T> endpoint,
Processor processor) |
Modifier and Type | Method and Description |
---|---|
protected Object |
doInvokeMethod(Map<String,Object> args)
Invoke the API method.
|
void |
interceptProperties(Map<String,Object> properties)
Intercept method invocation arguments used to find and invoke API method.
|
void |
interceptPropertyNames(Set<String> propertyNames)
Intercept property names used to find API Method.
|
void |
interceptResult(Object result,
Exchange resultExchange)
Do additional result exchange processing, for example, adding custom headers.
|
boolean |
isGreedy() |
boolean |
isSplitResult() |
protected int |
poll()
The polling method which is invoked periodically to poll this consumer
|
void |
setSplitResult(boolean splitResult) |
Object |
splitResult(Object result)
Split a complex result into result elements.
|
afterPoll, beforePoll, doShutdown, doStart, doStop, doSuspend, getBackoffCounter, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDelay, getInitialDelay, getPollStrategy, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isPollAllowed, isPolling, isSchedulerStarted, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, onInit, processEmptyMessage, run, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay, startScheduler
createUoW, doneUoW, getAsyncProcessor, getEndpoint, getExceptionHandler, getProcessor, getRoute, handleException, handleException, setExceptionHandler, setRoute, toString
doResume, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
protected final org.slf4j.Logger log
public AbstractApiConsumer(AbstractApiEndpoint<E,T> endpoint, Processor processor)
public boolean isGreedy()
isGreedy
in class ScheduledPollConsumer
protected int poll() throws Exception
ScheduledPollConsumer
poll
in class ScheduledPollConsumer
Exception
- can be thrown if an exception occurred during pollingpublic void interceptPropertyNames(Set<String> propertyNames)
PropertyNamesInterceptor
interceptPropertyNames
in interface PropertyNamesInterceptor
propertyNames
- argument names.public void interceptProperties(Map<String,Object> properties)
PropertiesInterceptor
interceptProperties
in interface PropertiesInterceptor
properties
- method invocation arguments.protected Object doInvokeMethod(Map<String,Object> args)
args
- method arguments from endpoint parameters.public Object splitResult(Object result)
ResultInterceptor
splitResult
in interface ResultInterceptor
result
- API method invocation resultpublic void interceptResult(Object result, Exchange resultExchange)
ResultInterceptor
interceptResult
in interface ResultInterceptor
result
- result of API method invocation.resultExchange
- result as a Camel exchange, may be a split result from Arrays or Collections.public final boolean isSplitResult()
public final void setSplitResult(boolean splitResult)
Apache Camel