Class SubscribableKafkaChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.kafka.channel.AbstractKafkaChannel
org.springframework.integration.kafka.channel.SubscribableKafkaChannel
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,InitializingBean
,ApplicationContextAware
,Lifecycle
,Phased
,SmartLifecycle
,ExpressionCapable
,IntegrationPattern
,NamedComponent
,IntegrationManagement
,ManageableLifecycle
,ManageableSmartLifecycle
,TrackableComponent
,MessageChannel
,SubscribableChannel
,InterceptableChannel
- Direct Known Subclasses:
PublishSubscribeKafkaChannel
public class SubscribableKafkaChannel extends AbstractKafkaChannel implements SubscribableChannel, ManageableSmartLifecycle
Subscribable channel backed by an Apache Kafka topic.
- Since:
- 5.4
- Author:
- Gary Russell, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides
-
Field Summary
Fields inherited from class org.springframework.integration.kafka.channel.AbstractKafkaChannel
topic
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, meters
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
-
Constructor Summary
Constructors Constructor Description SubscribableKafkaChannel(org.springframework.kafka.core.KafkaOperations<?,?> template, org.springframework.kafka.config.KafkaListenerContainerFactory<?> factory, String channelTopic)
Construct an instance with the provided parameters. -
Method Summary
Modifier and Type Method Description protected MessageDispatcher
createDispatcher()
int
getPhase()
boolean
isAutoStartup()
boolean
isRunning()
protected void
onInit()
Subclasses may implement this for initialization logic.void
setAutoStartup(boolean autoStartup)
Set the auto startup.void
setPhase(int phase)
Set the phase.void
start()
void
stop()
void
stop(Runnable callback)
boolean
subscribe(MessageHandler handler)
boolean
unsubscribe(MessageHandler handler)
Methods inherited from class org.springframework.integration.kafka.channel.AbstractKafkaChannel
doSend, getGroupId, setGroupId
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, addInterceptor, destroy, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, isLoggingEnabled, registerMetricsCaptor, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setLoggingEnabled, setMessageConverter, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, 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, 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.management.IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
Methods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
SubscribableKafkaChannel
public SubscribableKafkaChannel(org.springframework.kafka.core.KafkaOperations<?,?> template, org.springframework.kafka.config.KafkaListenerContainerFactory<?> factory, String channelTopic)Construct an instance with the provided parameters.- Parameters:
template
- template for sending.factory
- factory for creating a container for receiving.channelTopic
- the topic.
-
-
Method Details
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
setPhase
public void setPhase(int phase)Set the phase.- Parameters:
phase
- the phase.- See Also:
Phased
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceLifecycle
- Specified by:
isRunning
in interfaceManageableLifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup)Set the auto startup.- Parameters:
autoStartup
- true to automatically start.- See Also:
SmartLifecycle
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractMessageChannel
-
createDispatcher
-
start
public void start()- Specified by:
start
in interfaceLifecycle
- Specified by:
start
in interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceLifecycle
- Specified by:
stop
in interfaceManageableLifecycle
-
stop
- Specified by:
stop
in interfaceSmartLifecycle
-
subscribe
- Specified by:
subscribe
in interfaceSubscribableChannel
-
unsubscribe
- Specified by:
unsubscribe
in interfaceSubscribableChannel
-