Package com.softwareag.connectivity
Interface StatusReporter
-
public interface StatusReporter
An interface allowing a plug-in to report status values to the host. Typical usage is:
This interface's methods can be called safely from any thread. Ensure that no methods are called on this object after the plug-in has been shutdown.final StatusItem messagesTowardsHost = params.getStatusReporter().createStatusItem(chainId+"."+pluginName+".messagesTowardsHost", "initial value"); ... messagesTowardsHost.setStatus("new item"); // if string or other data type // or: messagesTowardsHost.increment(messageBatch.size()); // if integer
- Since:
- 10.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
StatusReporter.StatusItem
An interface that can be used to efficiently update the value associated with a single status key.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
STATUS_FAILED
A constant that should be used as the status value when a component is not currently operational due to an error condition.static java.lang.String
STATUS_ONLINE
A constant that should be used as the status value when a component is online, operational, connected, and ready to handles messages.static java.lang.String
STATUS_STARTING
A constant that should be used as the status value when a component is still starting, i.e.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearAll()
Remove all status values set by this reporter.StatusReporter.StatusItem
createStatusItem(java.lang.String key, long initialValue)
Creates a StatusItem interface that can be used to report status for a given key.StatusReporter.StatusItem
createStatusItem(java.lang.String key, java.lang.String initialValue)
Creates a StatusItem interface that can be used to report status for a given key.void
setStatus(java.util.Map<java.lang.String,java.lang.String> map)
Set multiple related string status values at the same time (atomically).
-
-
-
Field Detail
-
STATUS_ONLINE
static final java.lang.String STATUS_ONLINE
A constant that should be used as the status value when a component is online, operational, connected, and ready to handles messages.- See Also:
- Constant Field Values
-
STATUS_STARTING
static final java.lang.String STATUS_STARTING
A constant that should be used as the status value when a component is still starting, i.e. not yet online, but not failed.- See Also:
- Constant Field Values
-
STATUS_FAILED
static final java.lang.String STATUS_FAILED
A constant that should be used as the status value when a component is not currently operational due to an error condition.- See Also:
- Constant Field Values
-
-
Method Detail
-
createStatusItem
StatusReporter.StatusItem createStatusItem(java.lang.String key, java.lang.String initialValue)
Creates a StatusItem interface that can be used to report status for a given key. It is an error to call this more than once for a given key. The status item will be automatically removed when the plug-in instance is shutdown.- Parameters:
key
- a unique key that will identify this status item to the host. Typically this will include the chainId and plugin name, for example chainId+"."+pluginName+".messagesTowardsHost". The key will have any leading or trailing whitespace stripped. Keys may not be empty.initialValue
- the initial value for this item. Must not be null.- Returns:
- The StatusItem instance that can be used to update the status value as needed.
-
createStatusItem
StatusReporter.StatusItem createStatusItem(java.lang.String key, long initialValue)
Creates a StatusItem interface that can be used to report status for a given key. It is an error to call this more than once for a given key. The status item will be reported after the first call to any of the methods on StatusItem, e.gStatusReporter.StatusItem.setStatus(String)
. The status item will be automatically removed when the plug-in is shutdown.- Parameters:
key
- a unique key that will identify this status item to the host. Typically this will include the chainId and plugin name, for example chainId+"."+pluginName+".messagesTowardsHost". The key will have any leading or trailing whitespace stripped. Keys may not be empty.initialValue
- the initial value for this item.- Returns:
- The StatusItem instance that can be used to update the status value as needed.
-
setStatus
void setStatus(java.util.Map<java.lang.String,java.lang.String> map)
Set multiple related string status values at the same time (atomically). The more efficientStatusReporter.StatusItem.setStatus(String)
should be used instead unless there is a need to change multiple values atomically. Any status keys set using this method will be automatically removed when the plug-in instance is shutdown.- Parameters:
statusmap
- A map containing String keys and String values. Null values can be used inside the map to indicate that an existing item should be cleared. The map itself must be non-null and all keys and values must be strings. The keys will have any leading or trailing whitespace stripped. Keys may not be empty.
-
clearAll
void clearAll()
Remove all status values set by this reporter.This is called automatically after shutdown; there is usually no need to call it explicitly from a plug-in.
-
-