Class AbstractApiConsumer<E extends Enum<E> & ApiName,T>

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultConsumer
org.apache.camel.support.ScheduledPollConsumer
org.apache.camel.support.component.AbstractApiConsumer<E,T>
All Implemented Interfaces:
AutoCloseable, Runnable, org.apache.camel.Consumer, org.apache.camel.EndpointAware, org.apache.camel.health.HealthCheckAware, org.apache.camel.PollingConsumerPollingStrategy, org.apache.camel.RouteAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HostedService, org.apache.camel.spi.RouteIdAware, org.apache.camel.StatefulService, PropertiesInterceptor, PropertyNamesInterceptor, ResultInterceptor, org.apache.camel.Suspendable, org.apache.camel.SuspendableService

public abstract class AbstractApiConsumer<E extends Enum<E> & ApiName,T> extends ScheduledPollConsumer implements PropertyNamesInterceptor, PropertiesInterceptor, ResultInterceptor
Abstract base class for API Component Consumers.
  • Field Details

  • Constructor Details

    • AbstractApiConsumer

      public AbstractApiConsumer(AbstractApiEndpoint<E,T> endpoint, org.apache.camel.Processor processor)
  • Method Details

    • isGreedy

      public boolean isGreedy()
      Overrides:
      isGreedy in class ScheduledPollConsumer
    • poll

      protected int poll() throws Exception
      Description copied from class: ScheduledPollConsumer
      The polling method which is invoked periodically to poll this consumer
      Specified by:
      poll in class ScheduledPollConsumer
      Returns:
      number of messages polled, will be 0 if no message was polled at all.
      Throws:
      Exception - can be thrown if an exception occurred during polling
    • interceptPropertyNames

      public void interceptPropertyNames(Set<String> propertyNames)
      Description copied from interface: PropertyNamesInterceptor
      Intercept property names used to find API Method. Used to add any custom/hidden method arguments, which MUST be provided in interceptProperties() override.
      Specified by:
      interceptPropertyNames in interface PropertyNamesInterceptor
      Parameters:
      propertyNames - argument names.
    • interceptProperties

      public void interceptProperties(Map<String,Object> properties)
      Description copied from interface: PropertiesInterceptor
      Intercept method invocation arguments used to find and invoke API method. Can be overridden to add custom/hidden method arguments.
      Specified by:
      interceptProperties in interface PropertiesInterceptor
      Parameters:
      properties - method invocation arguments.
    • doInvokeMethod

      protected Object doInvokeMethod(Map<String,Object> args)
      Invoke the API method. This method can be overridden, for example to synchronize API calls for thread-unsafe proxies. Derived class MUST call super.doInvokeMethod() to invoke the API method.
      Parameters:
      args - method arguments from endpoint parameters.
      Returns:
      method invocation result.
    • splitResult

      public Object splitResult(Object result)
      Description copied from interface: ResultInterceptor
      Split a complex result into result elements.
      Specified by:
      splitResult in interface ResultInterceptor
      Parameters:
      result - API method invocation result
      Returns:
      either the same result if it cannot be split, an array or collection object with split results
    • interceptResult

      public void interceptResult(Object result, org.apache.camel.Exchange resultExchange)
      Description copied from interface: ResultInterceptor
      Do additional result exchange processing, for example, adding custom headers.
      Specified by:
      interceptResult in interface ResultInterceptor
      Parameters:
      result - result of API method invocation.
      resultExchange - result as a Camel exchange, may be a split result from Arrays or Collections.
    • isSplitResult

      public final boolean isSplitResult()
    • setSplitResult

      public final void setSplitResult(boolean splitResult)