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:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,ClientManager<T,,C> MqttComponent<C>
- Direct Known Subclasses:
Mqttv3ClientManager,Mqttv5ClientManager
public abstract class AbstractMqttClientManager<T,C>
extends Object
implements ClientManager<T,C>, org.springframework.context.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
-
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 org.springframework.context.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(org.springframework.context.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.context.Lifecycle
start, stopMethods inherited from interface org.springframework.integration.mqtt.core.MqttComponent
getConnectionInfoMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup, stop
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
AbstractMqttClientManager
-
-
Method Details
-
setManualAcks
public void setManualAcks(boolean manualAcks) -
getUrl
-
setUrl
-
getClientId
-
getApplicationEventPublisher
protected org.springframework.context.ApplicationEventPublisher 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
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
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 interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle- 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()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
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:
-