Enum Class MsgBus

java.lang.Object
java.lang.Enum<MsgBus>
uk.ac.diamond.daq.msgbus.MsgBus
All Implemented Interfaces:
Serializable, Comparable<MsgBus>, Constable

public enum MsgBus extends Enum<MsgBus>
Eagerly-initialised singleton (per-process but linked by JMS destination).
  • Enum Constant Details

    • INSTANCE

      public static final MsgBus INSTANCE
  • Method Details

    • values

      public static MsgBus[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MsgBus valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • post

      public static void post(Object obj)
      Send an object (which need not implement Msg/Serializable) to reqistered subscribers WITHIN THIS PROCESS ONLY. Logs what is posted.
      Throws:
      IllegalArgumentException - if argument is null.
    • publishAsJson

      public static void publishAsJson(Serializable msg)
    • publish

      public static void publish(Serializable msg)
      Send a Msg object to all consumers of topic, i.e. each process's MsgBus singleton, which on receiving it will then post it to all registered subscribers with an @Subscribe annotated method accepting arguments of that msg type.
      Throws:
      IllegalArgumentException - if argument is null.
    • subscribe

      public static void subscribe(Object subscriber)
      Register subscriber object to receive deserialized msg objects in zero or more of its @Subscribe annotated methods depending on msg type.
      Throws:
      IllegalArgumentException - if argument is null.
    • unsubscribe

      public static void unsubscribe(Object subscriber)
      Deregister subscriber object from receiving msg objects.
      Throws:
      IllegalArgumentException - if argument is null.
    • _shutdown

      public void _shutdown()
    • main

      public static void main(String[] args)
    • isLocalActiveMQ

      public static boolean isLocalActiveMQ()
      Returns:
      flag for Local ActiveMQ response indicating whether server is active