public class PubSubSystemCommands extends Object implements PubSubConnectionCommands, PubSubMqttConnectionCommands
PubSubSystem as static constants, and contains methods to
execute those commands. This class is considered to be sealed, instances are only obtained via
PubSubSystem.commands().| Modifier and Type | Field and Description |
|---|---|
static PubSubSystemCommandType<PubSubSystemConfToUaBinaryFileCommand,UaBinaryFile> |
INTERNAL_PUB_SUB_SYSTEM_CONF_TO_UABINARYFILE
Internal prototype
PubSubSystemCommand to generate a UaBinaryFile of the
current live configuration. |
PUB_SUB_RESTART_CONNECTION, PUB_SUB_SEND_DATA_SET_FIELDS, PUB_SUB_SEND_KEY_FRAMEINTERNAL_PUB_SUB_MQTT_SEND_MESSAGE| Modifier and Type | Method and Description |
|---|---|
<C extends PubSubSystemCommand<R>,R> |
createAndExecute(PubSubSystemCommandType<C,R> commandType,
Function<PubSubSystemConf,C> commandProvider)
Creates and executes a command based on the current configuration.
|
<C extends PubSubSystemCommand<R>,R> |
execute(PubSubSystemCommandType<C,R> commandType,
C command)
Executes the given command (at some point in the future, typically effectively immediately,
possibly before this method returns).
|
void |
sendDataSetFields(String connectionName,
String writerGroupName,
String writerName,
Iterable<String> fieldNames)
Forces the given Writer (of the given group of the given connection) to include the given
fields the next time it would send a DataSet message, even if the given fields have not
changed.
|
void |
sendKeyFrame(String connectionName,
String writerGroupName,
String writerName)
Forces the given Writer (of the given group of the given connection) to send a KeyFrame
(DataSet message with all field values set) the next time it would send a DataSet message, even
if not all field values have changed.
|
public static final PubSubSystemCommandType<PubSubSystemConfToUaBinaryFileCommand,UaBinaryFile> INTERNAL_PUB_SUB_SYSTEM_CONF_TO_UABINARYFILE
PubSubSystemCommand to generate a UaBinaryFile of the
current live configuration.public <C extends PubSubSystemCommand<R>,R> CompletableFuture<R> createAndExecute(PubSubSystemCommandType<C,R> commandType, Function<PubSubSystemConf,C> commandProvider)
CompletableFuture is
completed exceptionally with CancellationException.
The given function will get the current live configuration as it's parameter. If the
configuration is no longer suitable for the action, you can return null, in which case the
returned CompletableFuture is also internally canceled.
The PubSubSystemCommand created by the given function will be executed at some point in
the future, but it might also have been completed by the time this method returns.
public <C extends PubSubSystemCommand<R>,R> CompletableFuture<R> execute(PubSubSystemCommandType<C,R> commandType, C command)
PubSubSystemCommandType)
can be found as static constants in this class (PubSubSystemCommands), and the command
instances created with respective classes static build() method, such as
PubSubSendKeyframeCommand.builder().
Note that the configuration of the PubSubSystem could have changed in-between calling
this method and the command being executed internally. If this is of concern, the
createAndExecute(PubSubSystemCommandType, Function) can be used to generate the
command more related to the actual live configuration at the time it would have been executed.
This method will will effectively behave the same as
createAndExecute(commandType, conf -> command);, i.e. effectively the current live
configuration info is ignored.
public void sendDataSetFields(String connectionName, String writerGroupName, String writerName, Iterable<String> fieldNames) throws PubSubException
This method is a convenience method to calling
createAndExecute(PubSubSystemCommandType, Function) with
PubSubConnectionCommands.PUB_SUB_SEND_DATA_SET_FIELDS and calling
CompletableFuture.get() on the return. If CompletableFuture.get() throws and it
was due to a PubSubException, it is re-thrown directly, otherwise the exception is
wrapped in the PubSubException.
PubSubExceptionpublic void sendKeyFrame(String connectionName, String writerGroupName, String writerName) throws PubSubException
This method is a convenience method to calling
createAndExecute(PubSubSystemCommandType, Function) with
PubSubConnectionCommands.PUB_SUB_SEND_KEY_FRAME and calling
CompletableFuture.get() on the return. If CompletableFuture.get() throws and it
was due to a PubSubException, it is re-thrown directly, otherwise the exception is
wrapped in the PubSubException.
PubSubExceptionCopyright © 2026. All rights reserved.