Package com.hivemq.adapter.sdk.api.state
Interface ProtocolAdapterState
public interface ProtocolAdapterState
This 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 ClassesModifier and TypeInterfaceDescriptionstatic enumEnum for the connection status for this adapter.static enumEnum for connection status -
Method Summary
Modifier and TypeMethodDescriptionvoidreportErrorMessage(@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 Details
-
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
- 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
- Parameters:
runtimeStatus- the new runtime status
-
getRuntimeStatus
- Returns:
- the current runtime status.
-