org.springframework.integration.kafka.inbound
Class KafkaMessageDrivenChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.context.OrderlyShutdownCapable, org.springframework.integration.core.MessageProducer, org.springframework.integration.history.TrackableComponent, org.springframework.integration.support.context.NamedComponent
public class KafkaMessageDrivenChannelAdapter
- extends org.springframework.integration.endpoint.MessageProducerSupport
- implements org.springframework.integration.context.OrderlyShutdownCapable
- Author:
- Marius Bogoevici
| Fields inherited from class org.springframework.integration.endpoint.AbstractEndpoint |
lifecycleCondition, lifecycleLock |
| Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
logger |
| Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport |
sendMessage, setErrorChannel, setOutputChannel, setSendTimeout, setShouldTrack |
| Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint |
doStop, getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop |
| Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.springframework.integration.support.context.NamedComponent |
getComponentName |
KafkaMessageDrivenChannelAdapter
public KafkaMessageDrivenChannelAdapter(KafkaMessageListenerContainer messageListenerContainer)
setKeyDecoder
public void setKeyDecoder(kafka.serializer.Decoder<?> keyDecoder)
setPayloadDecoder
public void setPayloadDecoder(kafka.serializer.Decoder<?> payloadDecoder)
setAutoCommitOffset
public void setAutoCommitOffset(boolean autoCommitOffset)
- Automatically commit the offsets when 'true'. When 'false', the
adapter inserts a 'kafka_acknowledgment` header allowing the user to manually
commit the offset using the
Acknowledgment.acknowledge() method.
Default 'true'.
- Parameters:
autoCommitOffset - false to not auto-commit (default true).
setGenerateMessageId
public void setGenerateMessageId(boolean generateMessageId)
- Generate
Message ids for produced messages.
If set to false, will try to use a default value. By default set to false.
Note that this option is only guaranteed to work when
useMessageBuilderFactory is false (default).
If the latter is set to true, then some MessageBuilderFactory implementations such as
DefaultMessageBuilderFactory may ignore it.
- Parameters:
generateMessageId - true if a message id should be generated- Since:
- 1.1
setGenerateTimestamp
public void setGenerateTimestamp(boolean generateTimestamp)
- Generate
timestamp for produced messages. If set to false, -1 is used instead.
By default set to false.
Note that this option is only guaranteed to work when
useMessageBuilderFactory is false (default).
If the latter is set to true, then some MessageBuilderFactory implementations such as
DefaultMessageBuilderFactory may ignore it.
- Parameters:
generateTimestamp - true if a timestamp should be generated- Since:
- 1.1
setUseMessageBuilderFactory
public void setUseMessageBuilderFactory(boolean useMessageBuilderFactory)
- Use the
MessageBuilderFactory returned by IntegrationObjectSupport.getMessageBuilderFactory() to create messages.
- Parameters:
useMessageBuilderFactory - true if the MessageBuilderFactory returned by
IntegrationObjectSupport.getMessageBuilderFactory() should be used.- Since:
- 1.1
onInit
protected void onInit()
- Overrides:
onInit in class org.springframework.integration.endpoint.MessageProducerSupport
doStart
protected void doStart()
- Overrides:
doStart in class org.springframework.integration.endpoint.MessageProducerSupport
doStop
protected void doStop()
- Overrides:
doStop in class org.springframework.integration.endpoint.MessageProducerSupport
getComponentType
public java.lang.String getComponentType()
- Specified by:
getComponentType in interface org.springframework.integration.support.context.NamedComponent- Overrides:
getComponentType in class org.springframework.integration.context.IntegrationObjectSupport
beforeShutdown
public int beforeShutdown()
- Specified by:
beforeShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable
afterShutdown
public int afterShutdown()
- Specified by:
afterShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable