Class MQTTWorkflowEventSource
- java.lang.Object
-
- de.uplanet.lucy.server.workflow.eventsource.AbstractWorkflowEventSource
-
- de.uplanet.lucy.server.workflow.eventsource.AbstractSingleThreadedWorkflowEventSource
-
- de.uplanet.lucy.server.mqtt.workflow.eventsource.MQTTWorkflowEventSource
-
- All Implemented Interfaces:
IActivatableWorkflowObject
,de.uplanet.lucy.server.workflow.IImpersonateUser
,ILogLevelAware
,INamedWorkflowObject
,de.uplanet.lucy.server.workflow.INeedClusterInfo
,INeedWorkflow
,IRunnableWorkflowObject
,IStartableWorkflowObject
,ISupportAfterStopEvent
,ISupportBeforeStartEvent
,ISupportGlobalSharedState
,IWorkflowEventSource
,IWorkflowObject
,Serializable
public final class MQTTWorkflowEventSource extends AbstractSingleThreadedWorkflowEventSource implements de.uplanet.lucy.server.workflow.INeedClusterInfo, ISupportGlobalSharedState, ISupportBeforeStartEvent, ISupportAfterStopEvent
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface de.uplanet.lucy.server.workflow.IWorkflowObject
GUID_COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description MQTTWorkflowEventSource(String p_strGuid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getClientId()
Get the client identifier for the MQTT connection.de.uplanet.lucy.server.workflow.IClusterInfo
getClusterInfo()
int
getKeepAliveInterval()
Get the keep alive interval.long
getOnErrorRestartWaitTimeout()
Get the time in milliseconds the event source will wait before it tries to restart after an error occurred that prevented it to running the source loop.String
getPassword()
Get the password that is used when creating the MQTT connection.int
getQos()
Get the quality of service.String
getServerUri()
Get the server URI.String
getTopic()
Get the topic name;String
getUserName()
Get the user identity that used when creating the MQTT connection.boolean
isCleanSession()
Check whether the client and server should remember state across restarts and reconnects.boolean
isGlobalSharedState()
This property determines if a global shared state should be used for all events created by this event source.boolean
isRandomizeClientId()
This property determines if the client should connect with a unique randomized identifier.boolean
isReconnect()
Check whether the client will automatically attempt to reconnect to the server if the connection is lost.boolean
isSendAfterStopEvent()
This property determines if an after-stop event should be sent.boolean
isSendBeforeStartEvent()
This property determines if an before-start event should be sent.void
setCleanSession(boolean p_bCleanSession)
Set whether the client and server should remember state across restarts and reconnects.void
setClientId(String p_strClientId)
Set the client identifier for the MQTT connection.void
setClusterInfo(de.uplanet.lucy.server.workflow.IClusterInfo p_clusterInfo)
void
setGlobalSharedState(boolean p_bGlobalSharedState)
This property determines if a global shared state should be used for all events created by this event source.void
setKeepAliveInterval(int p_iKeepAliveInterval)
Set the keep alive interval.void
setOnErrorRestartWaitTimeout(long p_lOnErrorRestartWaitTimeout)
Set the time in milliseconds the event source will wait before it tries to restart after an error occurred that prevented it to running the source loop.void
setPassword(String p_strPassword)
Set the password that is used when creating the MQTT connection.void
setQos(int p_iQoS)
Set the quality of service.void
setRandomizeClientId(boolean p_bRandomizeClientId)
This property determines if the client should connect with a unique randomized identifier.void
setReconnect(boolean p_bReconnect)
Set whether the client will automatically attempt to reconnect to the server if the connection is lost.void
setSendAfterStopEvent(boolean p_bSendAfterStopEvent)
This property determines if an after-stop event should be sent.void
setSendBeforeStartEvent(boolean p_bSendBeforeStartEvent)
This property determines if an before-start event should be sent.void
setServerUri(String p_strServerUri)
Set the server URI.void
setTopic(String p_strTopicName)
Set the topic name;void
setUserName(String p_strUserName)
Set the user identity that used when creating the MQTT connection.-
Methods inherited from class de.uplanet.lucy.server.workflow.eventsource.AbstractSingleThreadedWorkflowEventSource
getDatabaseConnectionFactory, getStartDelay, getStopWaitTimeout, isLogVerbose, isRunning, setDatabaseConnectionFactory, setLogVerbose, setStartDelay, setStopWaitTimeout, shouldRun, start, stop
-
Methods inherited from class de.uplanet.lucy.server.workflow.eventsource.AbstractWorkflowEventSource
getGuid, getImpersonateUserGuid, getName, getWorkflow, hasImpersonateUserGuid, isActive, isRunWithLocalSystemPrivileges, setActive, setImpersonateUserGuid, setName, setRunWithLocalSystemPrivileges, setWorkflow, toString
-
-
-
-
Constructor Detail
-
MQTTWorkflowEventSource
public MQTTWorkflowEventSource(String p_strGuid)
-
-
Method Detail
-
getClusterInfo
public de.uplanet.lucy.server.workflow.IClusterInfo getClusterInfo()
- Specified by:
getClusterInfo
in interfacede.uplanet.lucy.server.workflow.INeedClusterInfo
-
setClusterInfo
public void setClusterInfo(de.uplanet.lucy.server.workflow.IClusterInfo p_clusterInfo)
- Specified by:
setClusterInfo
in interfacede.uplanet.lucy.server.workflow.INeedClusterInfo
-
getOnErrorRestartWaitTimeout
public long getOnErrorRestartWaitTimeout()
Get the time in milliseconds the event source will wait before it tries to restart after an error occurred that prevented it to running the source loop.The default value is 60000 milliseconds (one minute).
- Returns:
- The timeout in milliseconds.
-
setOnErrorRestartWaitTimeout
public void setOnErrorRestartWaitTimeout(long p_lOnErrorRestartWaitTimeout)
Set the time in milliseconds the event source will wait before it tries to restart after an error occurred that prevented it to running the source loop.- Parameters:
p_lOnErrorRestartWaitTimeout
- The timeout in milliseconds.
-
isGlobalSharedState
public boolean isGlobalSharedState()
Description copied from interface:ISupportGlobalSharedState
This property determines if a global shared state should be used for all events created by this event source.- Specified by:
isGlobalSharedState
in interfaceISupportGlobalSharedState
- Returns:
true
if a global shared state should be used, orfalse
otherwise.
-
setGlobalSharedState
public void setGlobalSharedState(boolean p_bGlobalSharedState)
Description copied from interface:ISupportGlobalSharedState
This property determines if a global shared state should be used for all events created by this event source.- Specified by:
setGlobalSharedState
in interfaceISupportGlobalSharedState
- Parameters:
p_bGlobalSharedState
-true
if a global shared state should be used, orfalse
otherwise.
-
isSendBeforeStartEvent
public boolean isSendBeforeStartEvent()
Description copied from interface:ISupportBeforeStartEvent
This property determines if an before-start event should be sent.- Specified by:
isSendBeforeStartEvent
in interfaceISupportBeforeStartEvent
- Returns:
true
if an event should be sent before the workflow object's activity is about to being started, orfalse
otherwise.
-
setSendBeforeStartEvent
public void setSendBeforeStartEvent(boolean p_bSendBeforeStartEvent)
Description copied from interface:ISupportBeforeStartEvent
This property determines if an before-start event should be sent.- Specified by:
setSendBeforeStartEvent
in interfaceISupportBeforeStartEvent
- Parameters:
p_bSendBeforeStartEvent
-true
if an event should be sent before the workflow object's activity is about to being started, orfalse
otherwise.
-
isSendAfterStopEvent
public boolean isSendAfterStopEvent()
Description copied from interface:ISupportAfterStopEvent
This property determines if an after-stop event should be sent.- Specified by:
isSendAfterStopEvent
in interfaceISupportAfterStopEvent
- Returns:
true
if an event should be sent after the workflow object's activity has been stopped, orfalse
otherwise.
-
setSendAfterStopEvent
public void setSendAfterStopEvent(boolean p_bSendAfterStopEvent)
Description copied from interface:ISupportAfterStopEvent
This property determines if an after-stop event should be sent.- Specified by:
setSendAfterStopEvent
in interfaceISupportAfterStopEvent
- Parameters:
p_bSendAfterStopEvent
-true
if an event should be sent after the workflow object's activity has been stopped, orfalse
otherwise.
-
getServerUri
public String getServerUri()
Get the server URI.- Returns:
- The server URI.
-
setServerUri
public void setServerUri(String p_strServerUri)
Set the server URI.- Parameters:
p_strServerUri
- The server URI.
-
getUserName
public String getUserName()
Get the user identity that used when creating the MQTT connection.- Returns:
- The user identity.
-
setUserName
public void setUserName(String p_strUserName)
Set the user identity that used when creating the MQTT connection.If this property is
null
(default) the default user identity will be used.- Parameters:
p_strUserName
- The user identity.
-
getPassword
public String getPassword()
Get the password that is used when creating the MQTT connection.- Returns:
- The password.
-
setPassword
public void setPassword(String p_strPassword)
Set the password that is used when creating the MQTT connection.- Parameters:
p_strPassword
- The password.
-
getClientId
public String getClientId()
Get the client identifier for the MQTT connection.The default client identifier is
ix-mqtt-consumer-OBJECT_GUID
.- Returns:
- The client identifier for the MQTT connection.
-
setClientId
public void setClientId(String p_strClientId)
Set the client identifier for the MQTT connection.The default client identifier is
ix-mqtt-consumer-OBJECT_GUID
.- Parameters:
p_strClientId
- The client identifier for the MQTT connection.
-
isRandomizeClientId
public boolean isRandomizeClientId()
This property determines if the client should connect with a unique randomized identifier.If
true
(default) a random suffix will be appended to the client ID that would normally be used.- Returns:
true
if the client ID is random, orfalse
otherwise.
-
setRandomizeClientId
public void setRandomizeClientId(boolean p_bRandomizeClientId)
This property determines if the client should connect with a unique randomized identifier.If
true
(default) a random suffix will be appended to the client ID that would normally be used.- Parameters:
p_bRandomizeClientId
-true
if the client ID should be random, orfalse
otherwise.
-
getTopic
public String getTopic()
Get the topic name;- Returns:
- The topic name.
-
setTopic
public void setTopic(String p_strTopicName)
Set the topic name;- Parameters:
p_strTopicName
- The topic name.
-
getQos
public int getQos()
Get the quality of service.Valid values are either 0, 1, or 2 (see
QOS.AT_MOST_ONCE_DELIVERY
,QOS.AT_LEAST_ONCE_DELIVERY
,QOS.EXACTLY_ONCE_DELIVERY
).- Returns:
- The quality of service.
-
setQos
public void setQos(int p_iQoS)
Set the quality of service.Valid values are either 0, 1, or 2 (see
QOS.AT_MOST_ONCE_DELIVERY
,QOS.AT_LEAST_ONCE_DELIVERY
,QOS.EXACTLY_ONCE_DELIVERY
).- Parameters:
p_iQoS
- The quality of service.
-
isReconnect
public boolean isReconnect()
Check whether the client will automatically attempt to reconnect to the server if the connection is lost.The default value is
true
.- Returns:
true
if the client will attempt to reconnect, orfalse
otherwise.
-
setReconnect
public void setReconnect(boolean p_bReconnect)
Set whether the client will automatically attempt to reconnect to the server if the connection is lost.The default value is
true
.- Parameters:
p_bReconnect
-true
if the client should attempt to reconnect, orfalse
otherwise.
-
isCleanSession
public boolean isCleanSession()
Check whether the client and server should remember state across restarts and reconnects.- Returns:
true
if the state should not be maintained, orfalse
otherwise.
-
setCleanSession
public void setCleanSession(boolean p_bCleanSession)
Set whether the client and server should remember state across restarts and reconnects.- If set to
false
both the client and server will maintain state across restarts of the client, the server and the connection. As state is maintained:- Message delivery will be reliable meeting the specified
QOS
even if the client, server or connection are restarted. - The server will treat a subscription as durable.
- Message delivery will be reliable meeting the specified
- If set to
true
the client and server will not maintain state across restarts of the client, the server or the connection. This means- Message delivery to the specified QOS cannot be maintained if the client, server or connection are restarted.
- The server will treat a subscription as non-durable.
The default value is
true
.- Parameters:
p_bCleanSession
-true
if the state should not be maintained, orfalse
otherwise.
- If set to
-
getKeepAliveInterval
public int getKeepAliveInterval()
Get the keep alive interval.- Returns:
- The keep alive interval.
-
setKeepAliveInterval
public void setKeepAliveInterval(int p_iKeepAliveInterval)
Set the keep alive interval.This value, measured in seconds, defines the maximum time interval between messages received. It enables the client to detect if the server is no longer available, without having to wait for the TCP/IP timeout. The client will ensure that at least one ping message travels across the network within each keep alive period.
A value of 0 disables keep alive processing in the client.
- Parameters:
p_iKeepAliveInterval
- the keep alive interval in seconds.
-
-