Interface StatusReporter


public interface StatusReporter
An interface allowing a plug-in to report status values to the host. Typical usage is:

 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
 
 
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.
Since:
10.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    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 final String
    A constant that should be used as the status value when a component is not currently operational due to an error condition.
    static final String
    A constant that should be used as the status value when a component is online, operational, connected, and ready to handles messages.
    static final String
    A constant that should be used as the status value when a component is still starting, i.e.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Remove all status values set by this reporter.
    createStatusItem(String key, long initialValue)
    Creates a StatusItem interface that can be used to report status for a given key.
    createStatusItem(String key, String initialValue)
    Creates a StatusItem interface that can be used to report status for a given key.
    void
    Set multiple related string status values at the same time (atomically).
  • Field Details

    • STATUS_ONLINE

      static final 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:
    • STATUS_STARTING

      static final 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:
    • STATUS_FAILED

      static final 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:
  • Method Details

    • createStatusItem

      StatusReporter.StatusItem createStatusItem(String key, 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(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.g StatusReporter.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(Map<String,String> map)
      Set multiple related string status values at the same time (atomically). The more efficient StatusReporter.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.