K - the key type.V - the request value type.R - the reply value type.public class KafkaInboundGateway<K,V,R>
extends org.springframework.integration.gateway.MessagingGatewaySupport
implements org.springframework.integration.core.Pausable, org.springframework.integration.context.OrderlyShutdownCapable
messagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, logger| Constructor and Description |
|---|
KafkaInboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> messageListenerContainer,
org.springframework.kafka.core.KafkaTemplate<K,R> kafkaTemplate)
Construct an instance with the provided container.
|
| Modifier and Type | Method and Description |
|---|---|
int |
afterShutdown() |
int |
beforeShutdown() |
protected void |
doStart() |
protected void |
doStop() |
java.lang.String |
getComponentType() |
protected org.springframework.core.AttributeAccessor |
getErrorMessageAttributes(org.springframework.messaging.Message<?> message) |
boolean |
isPaused() |
protected void |
onInit() |
void |
pause() |
void |
resume() |
void |
setBindSourceRecord(boolean bindSourceRecord)
Set to true to bind the source consumer record in the header named
IntegrationMessageHeaderAccessor.SOURCE_DATA. |
void |
setMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
Set the message converter; must be a
RecordMessageConverter or
BatchMessageConverter depending on mode. |
void |
setOnPartitionsAssignedSeekCallback(java.util.function.BiConsumer<java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>,org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)
Specify a
BiConsumer for seeks management during
ConsumerSeekAware.ConsumerSeekCallback#onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)
call from the KafkaMessageListenerContainer. |
void |
setPayloadType(java.lang.Class<?> payloadType)
When using a type-aware message converter (such as
StringJsonMessageConverter,
set the payload type the converter should create. |
void |
setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback)
A
RecoveryCallback instance for retry operation;
if null, the exception will be thrown to the container after retries are exhausted
(unless an error channel is configured). |
void |
setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
Specify a
RetryTemplate instance to wrap
KafkaInboundGateway.IntegrationRecordMessageListener into
RetryingMessageListenerAdapter. |
buildErrorMessage, buildSendTimer, destroy, getErrorChannel, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdoStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisRunning, start, stoppublic KafkaInboundGateway(org.springframework.kafka.listener.AbstractMessageListenerContainer<K,V> messageListenerContainer, org.springframework.kafka.core.KafkaTemplate<K,R> kafkaTemplate)
messageListenerContainer - the container.kafkaTemplate - the kafka template.public void setMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
RecordMessageConverter or
BatchMessageConverter depending on mode.messageConverter - the converter.public void setPayloadType(java.lang.Class<?> payloadType)
StringJsonMessageConverter,
set the payload type the converter should create. Defaults to Object.payloadType - the type.public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
RetryTemplate instance to wrap
KafkaInboundGateway.IntegrationRecordMessageListener into
RetryingMessageListenerAdapter.retryTemplate - the RetryTemplate to use.public void setRecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback)
RecoveryCallback instance for retry operation;
if null, the exception will be thrown to the container after retries are exhausted
(unless an error channel is configured).
Does not make sense if setRetryTemplate(RetryTemplate) isn't specified.recoveryCallback - the recovery callback.public void setOnPartitionsAssignedSeekCallback(java.util.function.BiConsumer<java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>,org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)
BiConsumer for seeks management during
ConsumerSeekAware.ConsumerSeekCallback#onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)
call from the KafkaMessageListenerContainer.
This is called from the internal
MessagingMessageListenerAdapter implementation.onPartitionsAssignedCallback - the BiConsumer to useConsumerSeekAware.onPartitionsAssigned(java.util.Map<org.apache.kafka.common.TopicPartition, java.lang.Long>, org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback)public void setBindSourceRecord(boolean bindSourceRecord)
IntegrationMessageHeaderAccessor.SOURCE_DATA.bindSourceRecord - true to bind.protected void onInit()
onInit in class org.springframework.integration.gateway.MessagingGatewaySupportprotected void doStart()
doStart in class org.springframework.integration.gateway.MessagingGatewaySupportprotected void doStop()
doStop in class org.springframework.integration.gateway.MessagingGatewaySupportpublic void pause()
pause in interface org.springframework.integration.core.Pausablepublic void resume()
resume in interface org.springframework.integration.core.Pausablepublic boolean isPaused()
isPaused in interface org.springframework.integration.core.Pausablepublic java.lang.String getComponentType()
getComponentType in interface org.springframework.integration.support.context.NamedComponentgetComponentType in class org.springframework.integration.gateway.MessagingGatewaySupportpublic int beforeShutdown()
beforeShutdown in interface org.springframework.integration.context.OrderlyShutdownCapablepublic int afterShutdown()
afterShutdown in interface org.springframework.integration.context.OrderlyShutdownCapableprotected org.springframework.core.AttributeAccessor getErrorMessageAttributes(org.springframework.messaging.Message<?> message)
getErrorMessageAttributes in class org.springframework.integration.gateway.MessagingGatewaySupport