Class KafkaInboundGateway<K,V,R>  
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.kafka.inbound.KafkaInboundGateway<K,V,R>  
- Type Parameters:
- K- the key type.
- V- the request value type.
- R- the reply value type.
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware,- org.springframework.beans.factory.BeanFactoryAware,- org.springframework.beans.factory.BeanNameAware,- org.springframework.beans.factory.DisposableBean,- 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.ExpressionCapable,- org.springframework.integration.context.OrderlyShutdownCapable,- org.springframework.integration.core.Pausable,- org.springframework.integration.IntegrationPattern,- KafkaInboundEndpoint,- org.springframework.integration.support.context.NamedComponent,- org.springframework.integration.support.management.IntegrationInboundManagement,- org.springframework.integration.support.management.IntegrationManagement,- org.springframework.integration.support.management.ManageableLifecycle,- org.springframework.integration.support.management.ManageableSmartLifecycle,- org.springframework.integration.support.management.TrackableComponent
public class KafkaInboundGateway<K,V,R>  
extends org.springframework.integration.gateway.MessagingGatewaySupport
implements KafkaInboundEndpoint, org.springframework.integration.core.Pausable, org.springframework.integration.context.OrderlyShutdownCapable
Inbound gateway.
- Since:
- 5.4
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupportorg.springframework.integration.gateway.MessagingGatewaySupport.ConvertingMessagingTemplateNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementorg.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.gateway.MessagingGatewaySupportmessagingTemplateFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.integration.kafka.inbound.KafkaInboundEndpointCONTEXT_ACKNOWLEDGMENT, CONTEXT_CONSUMER, CONTEXT_RECORDFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionKafkaInboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K, V> messageListenerContainer, org.springframework.kafka.core.KafkaTemplate<K, R> kafkaTemplate) Construct an instance with the provided container.
- 
Method SummaryModifier and TypeMethodDescriptionintintprotected voiddoStart()protected voiddoStop()protected org.springframework.core.AttributeAccessorgetErrorMessageAttributes(org.springframework.messaging.Message<?> message) booleanisPaused()protected voidonInit()voidpause()voidresume()voidsetBindSourceRecord(boolean bindSourceRecord) Set to true to bind the source consumer record in the header namedIntegrationMessageHeaderAccessor.SOURCE_DATA.voidsetMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter) Set the message converter; must be aRecordMessageConverterorBatchMessageConverterdepending on mode.voidsetOnPartitionsAssignedSeekCallback(BiConsumer<Map<org.apache.kafka.common.TopicPartition, Long>, org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback) Specify aBiConsumerfor seeks management duringConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)call from theKafkaMessageListenerContainer.voidsetPayloadType(Class<?> payloadType) When using a type-aware message converter such asStringJsonMessageConverter, set the payload type the converter should create.voidsetRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) ARecoveryCallbackinstance for retry operation; if null, the exception will be thrown to the container after retries are exhausted (unless an error channel is configured).voidsetRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Specify aRetryTemplateinstance to use for retrying deliveries.Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupportbuildErrorMessage, buildSendTimer, destroy, getErrorChannel, getErrorMessageStrategy, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdoStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.kafka.inbound.KafkaInboundEndpointdoWithRetryMethods inherited from interface org.springframework.integration.support.management.ManageableLifecycleisRunning, start, stopMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
KafkaInboundGatewaypublic KafkaInboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K, V> messageListenerContainer, org.springframework.kafka.core.KafkaTemplate<K, R> kafkaTemplate) Construct an instance with the provided container.- Parameters:
- messageListenerContainer- the container.
- kafkaTemplate- the kafka template.
 
 
- 
- 
Method Details- 
setMessageConverterpublic void setMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter) Set the message converter; must be aRecordMessageConverterorBatchMessageConverterdepending on mode.- Parameters:
- messageConverter- the converter.
 
- 
setPayloadTypeWhen using a type-aware message converter such asStringJsonMessageConverter, set the payload type the converter should create. Defaults toObject.- Parameters:
- payloadType- the type.
 
- 
setRetryTemplatepublic void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Specify aRetryTemplateinstance to use for retrying deliveries.IMPORTANT: This form of retry is blocking and could cause a rebalance if the aggregate retry delays across all polled records might exceed the max.poll.interval.ms. Instead, consider adding aDefaultErrorHandlerto the listener container, configured with aKafkaErrorSendingMessageRecoverer.- Parameters:
- retryTemplate- the- RetryTemplateto use.
 
- 
setRecoveryCallbackpublic void setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback) ARecoveryCallbackinstance for retry operation; if null, the exception will be thrown to the container after retries are exhausted (unless an error channel is configured). Only used ifsetRetryTemplate(RetryTemplate)is specified. Default is anErrorMessageSendingRecovererif an error channel has been provided. Set to null if you wish to throw the exception back to the container after retries are exhausted.- Parameters:
- recoveryCallback- the recovery callback.
 
- 
setOnPartitionsAssignedSeekCallbackpublic void setOnPartitionsAssignedSeekCallback(BiConsumer<Map<org.apache.kafka.common.TopicPartition, Long>, org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback) Specify aBiConsumerfor seeks management duringConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)call from theKafkaMessageListenerContainer. This is called from the internalMessagingMessageListenerAdapterimplementation.- Parameters:
- onPartitionsAssignedCallback- the- BiConsumerto use
- See Also:
- 
- ConsumerSeekAware.onPartitionsAssigned(java.util.Map<org.apache.kafka.common.TopicPartition, java.lang.Long>, org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback)
 
 
- 
setBindSourceRecordpublic void setBindSourceRecord(boolean bindSourceRecord) Set to true to bind the source consumer record in the header namedIntegrationMessageHeaderAccessor.SOURCE_DATA.- Parameters:
- bindSourceRecord- true to bind.
 
- 
onInitprotected void onInit()- Overrides:
- onInitin class- org.springframework.integration.gateway.MessagingGatewaySupport
 
- 
doStartprotected void doStart()- Overrides:
- doStartin class- org.springframework.integration.gateway.MessagingGatewaySupport
 
- 
doStopprotected void doStop()- Overrides:
- doStopin class- org.springframework.integration.gateway.MessagingGatewaySupport
 
- 
pausepublic void pause()- Specified by:
- pausein interface- org.springframework.integration.core.Pausable
 
- 
resumepublic void resume()- Specified by:
- resumein interface- org.springframework.integration.core.Pausable
 
- 
isPausedpublic boolean isPaused()- Specified by:
- isPausedin interface- org.springframework.integration.core.Pausable
 
- 
getComponentType- Specified by:
- getComponentTypein interface- org.springframework.integration.support.context.NamedComponent
- Overrides:
- getComponentTypein class- org.springframework.integration.gateway.MessagingGatewaySupport
 
- 
beforeShutdownpublic int beforeShutdown()- Specified by:
- beforeShutdownin interface- org.springframework.integration.context.OrderlyShutdownCapable
 
- 
afterShutdownpublic int afterShutdown()- Specified by:
- afterShutdownin interface- org.springframework.integration.context.OrderlyShutdownCapable
 
- 
getErrorMessageAttributesprotected org.springframework.core.AttributeAccessor getErrorMessageAttributes(org.springframework.messaging.Message<?> message) - Overrides:
- getErrorMessageAttributesin class- org.springframework.integration.gateway.MessagingGatewaySupport
 
 
-