Package com.hivemq.adapter.sdk.api.state
Interface ProtocolAdapterState
-
public interface ProtocolAdapterStateThis class represents the current status of a protocol adapter. There are different methods to update and get both the runtime status and the connection status of a protocol adapter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classProtocolAdapterState.ConnectionStatusEnum for the connection status for this adapter.static classProtocolAdapterState.RuntimeStatusEnum for connection status
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ProtocolAdapterState.ConnectionStatusgetConnectionStatus()@Nullable StringgetLastErrorMessage()@NotNull ProtocolAdapterState.RuntimeStatusgetRuntimeStatus()voidreportErrorMessage(@Nullable Throwable throwable, @Nullable String errorMessage, boolean sendEvent)Reports any error message for this adapter.booleansetConnectionStatus(@NotNull ProtocolAdapterState.ConnectionStatus connectionStatus)Updates the current connection statusvoidsetErrorConnectionStatus(@Nullable Throwable throwable, @Nullable String errorMessage)Signalizes that there was an error during connection establishment to the PLCvoidsetRuntimeStatus(@NotNull ProtocolAdapterState.RuntimeStatus runtimeStatus)
-
-
-
Method Detail
-
getLastErrorMessage
@Nullable @Nullable String getLastErrorMessage()
- Returns:
- the last error message this adapter created or null if none was created yet.
-
setConnectionStatus
boolean setConnectionStatus(@NotNull @NotNull ProtocolAdapterState.ConnectionStatus connectionStatus)
Updates the current connection status- Parameters:
connectionStatus- the updated status- Returns:
- true: the update set a new state, false: the current and the updated status is the same
-
getConnectionStatus
@NotNull @NotNull ProtocolAdapterState.ConnectionStatus getConnectionStatus()
- Returns:
- the current connection status
-
setErrorConnectionStatus
void setErrorConnectionStatus(@Nullable @Nullable Throwable throwable, @Nullable @Nullable String errorMessage)
Signalizes that there was an error during connection establishment to the PLC- Parameters:
throwable- a throwable indicating the cause.errorMessage- a error message to deliver more insights into the problem.
-
reportErrorMessage
void reportErrorMessage(@Nullable @Nullable Throwable throwable, @Nullable @Nullable String errorMessage, boolean sendEvent)
Reports any error message for this adapter.- Parameters:
throwable- a throwable indicating the cause.errorMessage- a error message to deliver more insights into the problem.sendEvent- true: anEventfor this error is created and sent via theEventService, False: no event is created or sent.
-
setRuntimeStatus
void setRuntimeStatus(@NotNull @NotNull ProtocolAdapterState.RuntimeStatus runtimeStatus)
- Parameters:
runtimeStatus- the new runtime status
-
getRuntimeStatus
@NotNull @NotNull ProtocolAdapterState.RuntimeStatus getRuntimeStatus()
- Returns:
- the current runtime status.
-
-