Class AbstractMqttClientManager<T,C>
java.lang.Object
org.springframework.integration.mqtt.core.AbstractMqttClientManager<T,C>
- Type Parameters:
T- MQTT client typeC- MQTT connection options type (v5 or v3)
- All Implemented Interfaces:
Aware,BeanNameAware,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,ClientManager<T,,C> MqttComponent<C>
- Direct Known Subclasses:
Mqttv3ClientManager,Mqttv5ClientManager
public abstract class AbstractMqttClientManager<T,C>
extends Object
implements ClientManager<T,C>, ApplicationEventPublisherAware
Abstract class for MQTT client managers which can be a base for any common v3/v5 client manager implementation.
Contains some basic utility and implementation-agnostic fields and methods.
- Since:
- 6.0
- Author:
- Artem Vozhdayenko, Artem Bilan
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.mqtt.core.ClientManager
ClientManager.ConnectCallback -
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(ClientManager.ConnectCallback connectCallback) Register a callback for theconnectCompleteevent from the client.protected ApplicationEventPublisherReturn this component's bean name.protected Set<ClientManager.ConnectCallback>Return the managed client.protected StringintgetPhase()The phase of component autostart inSmartLifecycle.protected StringgetUrl()booleanIf manual acknowledge has to be used; false by default.booleanbooleanremoveCallback(ClientManager.ConnectCallback connectCallback) Remove the callback from registration.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetBeanName(String name) protected voidvoidsetManualAcks(boolean manualAcks) voidsetPhase(int phase) Set the phase of component autostart inSmartLifecycle.protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.mqtt.core.MqttComponent
getConnectionInfoMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup, stop
-
Field Details
-
logger
-
-
Constructor Details
-
AbstractMqttClientManager
-
-
Method Details
-
setManualAcks
public void setManualAcks(boolean manualAcks) -
getUrl
-
setUrl
-
getClientId
-
getApplicationEventPublisher
-
setClient
-
getCallbacks
-
isManualAcks
public boolean isManualAcks()Description copied from interface:ClientManagerIf manual acknowledge has to be used; false by default.- Specified by:
isManualAcksin interfaceClientManager<T,C> - Returns:
- true if manual acknowledge has to be used.
-
getClient
Description copied from interface:ClientManagerReturn the managed client.- Specified by:
getClientin interfaceClientManager<T,C> - Returns:
- the managed client.
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
getBeanName
Description copied from interface:MqttComponentReturn this component's bean name.- Specified by:
getBeanNamein interfaceMqttComponent<T>- Returns:
- the bean name.
-
getPhase
public int getPhase()The phase of component autostart inSmartLifecycle. If the custom one is required, note that for the correct behavior it should be less than phase ofAbstractMqttMessageDrivenChannelAdapterimplementations. The default phase isDEFAULT_MANAGER_PHASE.- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle- Returns:
SmartLifecycleautostart phase- See Also:
-
addCallback
Description copied from interface:ClientManagerRegister a callback for theconnectCompleteevent from the client.- Specified by:
addCallbackin interfaceClientManager<T,C> - Parameters:
connectCallback- aClientManager.ConnectCallbackto register.
-
removeCallback
Description copied from interface:ClientManagerRemove the callback from registration.- Specified by:
removeCallbackin interfaceClientManager<T,C> - Parameters:
connectCallback- aClientManager.ConnectCallbackto unregister.- Returns:
- true if callback was removed.
-
isRunning
public boolean isRunning() -
setPhase
public void setPhase(int phase) Set the phase of component autostart inSmartLifecycle. If the custom one is required, note that for the correct behavior it should be less than phase ofAbstractMqttMessageDrivenChannelAdapterimplementations.- See Also:
-