public class PubSubSystem extends Object
start(). Note that if you wish to listen
for events, the listeners should be registered with
addEventListener(PubSubEventType, Consumer) before calling start().
A started PubSubSystem must be shut down with shutdown(). It can be then restarted by
calling start() again.| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<PubSubSystemConf> |
currentConf |
protected com.prosysopc.ua.pubsub.PubSubDI |
diContext
Internal Dependency Injection context, used internally.
|
protected ConcurrentHashMap<PubSubEventType<?>,CopyOnWriteArrayList<Consumer<?>>> |
eventListeners
Holds all event listeners.
|
protected ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PublishedEventDataSet> |
publishedEventDataSets |
protected ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PublishedVariableDataSet> |
publishedVariableDataSets
1.04 Part 4 section 6.2.2.4 Table 9 PublishedDataSetDataType Structure for the name field "Name
of the PublishedDataSet.
|
protected ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PubSubConnection> |
pubSubConnections
Per Errata, each PubSubConnectionDataType has unique name in the context of a
PubSubConfiguration, therefore we can key on that as a single configuration handles in entire
PubSubSystem.
|
| Modifier and Type | Method and Description |
|---|---|
<E extends PubSubSystemEvent> |
addEventListener(PubSubEventType<E> eventType,
Consumer<E> eventListener)
Adds a listener of the specified type.
|
<E extends PubSubSystemEvent> |
addEventListener(PubSubEventType<E> eventType,
Consumer<E> eventListener,
Executor executor)
Adds a listener of the specified type.
|
PubSubSystemCommands |
commands()
Returns a handle that can be used to execute
PubSubSystemCommands on this instance. |
static PubSubSystem |
createFor(UaApplication uaApplication,
PubSubSystemConf initialConf)
Creates a
PubSubSystem that uses the given UaApplication as the source and
target of for Publisher and Subscriber parts.The returned PubSubSystem must be started
by invoking start(). |
static PubSubSystem |
createFor(UaApplication uaApplication,
PubSubSystemConf initialConf,
PubSubSystemOverrides overrides)
Creates a
PubSubSystem that uses the given UaApplication as the source and
target of for Publisher and Subscriber parts. |
protected <E extends PubSubSystemEvent> |
fireEvent(PubSubEventType<E> eventType,
Supplier<E> eventSupplier)
Fires an event to all listeners of the given type.
|
PubSubSystemConf |
getConfiguration()
Returns a snapshot of the current configuration.
|
<E extends PubSubSystemEvent> |
removeEventListener(PubSubEventType<E> eventType,
Consumer<E> eventListener)
Removes a listener of the specified type.
|
<E extends PubSubSystemEvent> |
removeEventListener(PubSubEventType<E> eventType,
Consumer<E> eventListener,
Executor executor)
Removes a listener of the specified type that was previously added with
addEventListener(PubSubEventType, Consumer, Executor) specifying an Executor . |
protected PubSubDataSetMetaDataConf |
searchMetaData(com.prosysopc.ua.pubsub.InternalPubSubMetaDataSearchParameters params)
Internal, search metadata per given parameters.
|
void |
shutdown()
Shuts the PubSubSystem down.
|
void |
start()
Starts the PubSubSystem.
|
void |
updateConfiguration(PubSubFunction<PubSubSystemConf,PubSubSystemConf> changeOperation)
Updates the configuration of this system.
|
protected final ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PubSubConnection> pubSubConnections
protected final ConcurrentHashMap<PubSubEventType<?>,CopyOnWriteArrayList<Consumer<?>>> eventListeners
protected final com.prosysopc.ua.pubsub.PubSubDI diContext
protected final ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PublishedVariableDataSet> publishedVariableDataSets
protected final ConcurrentHashMap<String,com.prosysopc.ua.pubsub.PublishedEventDataSet> publishedEventDataSets
protected final AtomicReference<PubSubSystemConf> currentConf
public static PubSubSystem createFor(UaApplication uaApplication, PubSubSystemConf initialConf)
PubSubSystem that uses the given UaApplication as the source and
target of for Publisher and Subscriber parts.The returned PubSubSystem must be started
by invoking start().uaApplication - the context (source and/or target of data) for the PubSubSystem to be
created.initialConf - the initial configuration for the PubSubSystem.public static PubSubSystem createFor(UaApplication uaApplication, PubSubSystemConf initialConf, PubSubSystemOverrides overrides)
PubSubSystem that uses the given UaApplication as the source and
target of for Publisher and Subscriber parts. Overrides certain internal systems as configured
to the given PubSubSystemOverrides. The returned PubSubSystem must be started
by invoking start().uaApplication - the context (source and/or target of data) for the PubSubSystem to be
created.initialConf - the initial configuration for the PubSubSystem. * @param overrides extra
options to override internal functionality or provide additional information needed for
certain use-cases.public <E extends PubSubSystemEvent> void addEventListener(PubSubEventType<E> eventType, Consumer<E> eventListener)
PubSubEventType static constants for the
list of all event types. A listener can be added more than once (will receive multiple times
the same notification).E - the eventeventType - event type holder instance that marks the event classeventListener - a consumer for the event, i.e. the listener to addpublic <E extends PubSubSystemEvent> void addEventListener(PubSubEventType<E> eventType, Consumer<E> eventListener, Executor executor)
PubSubEventType static constants for the
list of all event types. A listener can be added more than once (will receive multiple times
the same notification). The listener method will be called in the supplied Executor.E - the eventeventType - event type holder instance that marks the event class.eventListener - a consumer for the event, i.e. the listener to add.executor - not null, the Executor which is used to call the listener.public PubSubSystemCommands commands()
PubSubSystemCommands on this instance.public PubSubSystemConf getConfiguration()
public <E extends PubSubSystemEvent> void removeEventListener(PubSubEventType<E> eventType, Consumer<E> eventListener)
PubSubEventType static constants for the
list of all event types.E - the eventeventType - event type holder instance that marks the event classeventListener - a consumer for the event, i.e. the listener to removepublic <E extends PubSubSystemEvent> void removeEventListener(PubSubEventType<E> eventType, Consumer<E> eventListener, Executor executor)
addEventListener(PubSubEventType, Consumer, Executor) specifying an Executor .
See PubSubEventType static constants for the list of all event types.E - the eventeventType - event type holder instance that marks the event classeventListener - a consumer for the event, i.e. the listener to removeexecutor - not null, the same executor, that was used a
addEventListener(PubSubEventType, Consumer, Executor) call.public void shutdown()
public void start()
throws PubSubException
PubSubException - If any errors occur while starting.public void updateConfiguration(PubSubFunction<PubSubSystemConf,PubSubSystemConf> changeOperation) throws PubSubException
changeOperation - an operation that will change the configuration. It receives the current
running configuration as input and shall give the new configuration as output.PubSubException - if any error occurs that prevents the changeOperation from being
appliedprotected <E extends PubSubSystemEvent> void fireEvent(PubSubEventType<E> eventType, Supplier<E> eventSupplier)
E - event type.eventType - event type holder.eventSupplier - supplier, which will create the event, if there are any listenerse for it.protected PubSubDataSetMetaDataConf searchMetaData(com.prosysopc.ua.pubsub.InternalPubSubMetaDataSearchParameters params)
Copyright © 2026. All rights reserved.