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.context.OrderlyShutdownCapable
messagingTemplatelifecycleCondition, lifecycleLock| 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) |
protected void |
onInit() |
void |
setMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
Set the message converter; must be a
RecordMessageConverter or
BatchMessageConverter depending on mode. |
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<? extends java.lang.Object> 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, getErrorChannel, getManagedName, getManagedType, getMessageCount, getMessageCountLong, getOverrides, getReplyChannel, getRequestChannel, isCountsEnabled, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerReplyMessageCorrelatorIfNecessary, reset, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, setCountsEnabled, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdestroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, setTaskScheduler, start, stop, stopafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic 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<? extends java.lang.Object> 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.protected void onInit()
throws java.lang.Exception
onInit in class org.springframework.integration.gateway.MessagingGatewaySupportjava.lang.Exceptionprotected void doStart()
doStart in class org.springframework.integration.gateway.MessagingGatewaySupportprotected void doStop()
doStop in class org.springframework.integration.gateway.MessagingGatewaySupportpublic 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