Class DefaultConsumerTemplate

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.ConsumerTemplate, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    public class DefaultConsumerTemplate
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.ConsumerTemplate
    Default implementation of ConsumerTemplate.
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILDED, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultConsumerTemplate​(org.apache.camel.CamelContext camelContext)  
    • Constructor Detail

      • DefaultConsumerTemplate

        public DefaultConsumerTemplate​(org.apache.camel.CamelContext camelContext)
    • Method Detail

      • getMaximumCacheSize

        public int getMaximumCacheSize()
        Specified by:
        getMaximumCacheSize in interface org.apache.camel.ConsumerTemplate
      • setMaximumCacheSize

        public void setMaximumCacheSize​(int maximumCacheSize)
        Specified by:
        setMaximumCacheSize in interface org.apache.camel.ConsumerTemplate
      • getCurrentCacheSize

        public int getCurrentCacheSize()
        Specified by:
        getCurrentCacheSize in interface org.apache.camel.ConsumerTemplate
      • cleanUp

        public void cleanUp()
        Specified by:
        cleanUp in interface org.apache.camel.ConsumerTemplate
      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.ConsumerTemplate
      • receive

        public org.apache.camel.Exchange receive​(String endpointUri)
        Specified by:
        receive in interface org.apache.camel.ConsumerTemplate
      • receive

        public org.apache.camel.Exchange receive​(org.apache.camel.Endpoint endpoint)
        Specified by:
        receive in interface org.apache.camel.ConsumerTemplate
      • receive

        public org.apache.camel.Exchange receive​(String endpointUri,
                                                 long timeout)
        Specified by:
        receive in interface org.apache.camel.ConsumerTemplate
      • receive

        public org.apache.camel.Exchange receive​(org.apache.camel.Endpoint endpoint,
                                                 long timeout)
        Specified by:
        receive in interface org.apache.camel.ConsumerTemplate
      • receiveNoWait

        public org.apache.camel.Exchange receiveNoWait​(String endpointUri)
        Specified by:
        receiveNoWait in interface org.apache.camel.ConsumerTemplate
      • receiveNoWait

        public org.apache.camel.Exchange receiveNoWait​(org.apache.camel.Endpoint endpoint)
        Specified by:
        receiveNoWait in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public Object receiveBody​(String endpointUri)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public Object receiveBody​(org.apache.camel.Endpoint endpoint)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public Object receiveBody​(String endpointUri,
                                  long timeout)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public Object receiveBody​(org.apache.camel.Endpoint endpoint,
                                  long timeout)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBodyNoWait

        public Object receiveBodyNoWait​(String endpointUri)
        Specified by:
        receiveBodyNoWait in interface org.apache.camel.ConsumerTemplate
      • receiveBodyNoWait

        public Object receiveBodyNoWait​(org.apache.camel.Endpoint endpoint)
        Specified by:
        receiveBodyNoWait in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public <T> T receiveBody​(String endpointUri,
                                 Class<T> type)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public <T> T receiveBody​(org.apache.camel.Endpoint endpoint,
                                 Class<T> type)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public <T> T receiveBody​(String endpointUri,
                                 long timeout,
                                 Class<T> type)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBody

        public <T> T receiveBody​(org.apache.camel.Endpoint endpoint,
                                 long timeout,
                                 Class<T> type)
        Specified by:
        receiveBody in interface org.apache.camel.ConsumerTemplate
      • receiveBodyNoWait

        public <T> T receiveBodyNoWait​(String endpointUri,
                                       Class<T> type)
        Specified by:
        receiveBodyNoWait in interface org.apache.camel.ConsumerTemplate
      • receiveBodyNoWait

        public <T> T receiveBodyNoWait​(org.apache.camel.Endpoint endpoint,
                                       Class<T> type)
        Specified by:
        receiveBodyNoWait in interface org.apache.camel.ConsumerTemplate
      • doneUoW

        public void doneUoW​(org.apache.camel.Exchange exchange)
        Specified by:
        doneUoW in interface org.apache.camel.ConsumerTemplate
      • resolveMandatoryEndpoint

        protected org.apache.camel.Endpoint resolveMandatoryEndpoint​(String endpointUri)
      • extractResultBody

        protected Object extractResultBody​(org.apache.camel.Exchange result)
        Extracts the body from the given result.

        If the exchange pattern is provided it will try to honor it and retrieve the body from either IN or OUT according to the pattern.

        Parameters:
        result - the result
        Returns:
        the result, can be null.
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doShutdown

        protected void doShutdown()
                           throws Exception
        Overrides:
        doShutdown in class org.apache.camel.support.service.BaseService
        Throws:
        Exception