Class KafkaComponent

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Component, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.SSLContextParametersAware, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Component("kafka")
    public class KafkaComponent
    extends org.apache.camel.support.DefaultComponent
    implements org.apache.camel.SSLContextParametersAware
    • Field Summary

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

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected KafkaEndpoint createEndpoint​(String uri, String remaining, Map<String,​Object> parameters)  
      protected void doInit()  
      KafkaConfiguration getConfiguration()  
      KafkaClientFactory getKafkaClientFactory()  
      KafkaManualCommitFactory getKafkaManualCommitFactory()  
      PollExceptionStrategy getPollExceptionStrategy()  
      boolean isUseGlobalSslContextParameters()  
      void setConfiguration​(KafkaConfiguration configuration)
      Allows to pre-configure the Kafka component with common options that the endpoints will reuse.
      void setKafkaClientFactory​(KafkaClientFactory kafkaClientFactory)
      Factory to use for creating KafkaConsumer and KafkaProducer instances.
      void setKafkaManualCommitFactory​(KafkaManualCommitFactory kafkaManualCommitFactory)
      Factory to use for creating KafkaManualCommit instances.
      void setPollExceptionStrategy​(PollExceptionStrategy pollExceptionStrategy)
      To use a custom strategy with the consumer to control how to handle exceptions thrown from the Kafka broker while pooling messages.
      void setUseGlobalSslContextParameters​(boolean useGlobalSslContextParameters)
      Enable usage of global SSL context parameters.
      • Methods inherited from class org.apache.camel.support.DefaultComponent

        afterConfiguration, createEndpoint, createEndpoint, doBuild, doStart, doStop, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getComponentPropertyConfigurer, getDefaultName, getEndpointPropertyConfigurer, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, resolveRawParameterValues, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setLazyStartProducer, setProperties, setProperties, setProperties, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURI
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, 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
      • Methods inherited from interface org.apache.camel.CamelContextAware

        getCamelContext, setCamelContext
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.SSLContextParametersAware

        retrieveGlobalSslContextParameters
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • KafkaComponent

        public KafkaComponent()
      • KafkaComponent

        public KafkaComponent​(org.apache.camel.CamelContext context)
    • Method Detail

      • setConfiguration

        public void setConfiguration​(KafkaConfiguration configuration)
        Allows to pre-configure the Kafka component with common options that the endpoints will reuse.
      • isUseGlobalSslContextParameters

        public boolean isUseGlobalSslContextParameters()
        Specified by:
        isUseGlobalSslContextParameters in interface org.apache.camel.SSLContextParametersAware
      • setUseGlobalSslContextParameters

        public void setUseGlobalSslContextParameters​(boolean useGlobalSslContextParameters)
        Enable usage of global SSL context parameters.
        Specified by:
        setUseGlobalSslContextParameters in interface org.apache.camel.SSLContextParametersAware
      • setKafkaManualCommitFactory

        public void setKafkaManualCommitFactory​(KafkaManualCommitFactory kafkaManualCommitFactory)
        Factory to use for creating KafkaManualCommit instances. This allows to plugin a custom factory to create custom KafkaManualCommit instances in case special logic is needed when doing manual commits that deviates from the default implementation that comes out of the box.
      • setKafkaClientFactory

        public void setKafkaClientFactory​(KafkaClientFactory kafkaClientFactory)
        Factory to use for creating KafkaConsumer and KafkaProducer instances. This allows to configure a custom factory to create instances with logic that extends the vanilla Kafka clients.
      • setPollExceptionStrategy

        public void setPollExceptionStrategy​(PollExceptionStrategy pollExceptionStrategy)
        To use a custom strategy with the consumer to control how to handle exceptions thrown from the Kafka broker while pooling messages.
      • doInit

        protected void doInit()
                       throws Exception
        Overrides:
        doInit in class org.apache.camel.support.DefaultComponent
        Throws:
        Exception