org.eclipse.viatra.integration.mwe2.mwe2impl

## Class MessageBroker

- java.lang.Object
- - org.eclipse.viatra.integration.mwe2.mwe2impl.MessageBroker

- All Implemented Interfaces:
    IMessageBroker

      public class MessageBroker
      extends java.lang.Object
      implements IMessageBroker

  The MessageBroker is a singleton class that manages topics and subscriptions.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static MessageBroker` | `broker`
    `protected java.util.List<ITopic>` | `topics`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MessageBroker()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MessageBroker` | `getInstance()`
    `java.util.List<IMessage<?>>` | `getMessages(java.lang.String topicName, ITransformationStep step)` Returns all messages sent to a topic that have not been processed by the specified transformation step.
    `protected ITopic` | `getTopic(java.lang.String topicName)`
    `void` | `removeMessage(java.lang.String topicName, ITransformationStep step, IMessage<?> message)` Removes the specified message from the specified topic and the specified subscriber queue.
    `protected void` | `removeTopic(java.lang.String topicName)`
    `void` | `sendMessage(java.lang.String topicName, IMessage<?> message)` Send the specified message to the topic whose name is matching the @param topicName parameter.
    `void` | `subscribeTo(java.lang.String topicName, ITransformationStep step)` Subscribes the given transformation step to the Topic whose name matches the @param topicName parameter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### broker

          protected static MessageBroker broker

    - #### topics

          protected java.util.List<ITopic> topics

  - ### Constructor Detail

    - #### MessageBroker

          protected MessageBroker()

  - ### Method Detail

    - #### getInstance

          public static MessageBroker getInstance()

    - #### subscribeTo

          public void subscribeTo(java.lang.String topicName,
                                  ITransformationStep step)

      Description copied from interface: `IMessageBroker`
      Subscribes the given transformation step to the Topic whose name matches the @param topicName parameter.
      Specified by:
        `subscribeTo` in interface `IMessageBroker`

    - #### sendMessage

          public void sendMessage(java.lang.String topicName,
                                  IMessage<?> message)

      Description copied from interface: `IMessageBroker`
      Send the specified message to the topic whose name is matching the @param topicName parameter.
      Specified by:
        `sendMessage` in interface `IMessageBroker`

    - #### getMessages

          public java.util.List<IMessage<?>> getMessages(java.lang.String topicName,
                                                         ITransformationStep step)

      Returns all messages sent to a topic that have not been processed by the specified transformation step.
      Specified by:
        `getMessages` in interface `IMessageBroker`

    - #### removeMessage

          public void removeMessage(java.lang.String topicName,
                                    ITransformationStep step,
                                    IMessage<?> message)

      Removes the specified message from the specified topic and the specified subscriber queue. It can be used to inform the broker and the topic that the given transformation step has finished processing the specified message, and therefore it is no longer needed.
      Specified by:
        `removeMessage` in interface `IMessageBroker`

    - #### getTopic

          protected ITopic getTopic(java.lang.String topicName)

    - #### removeTopic

          protected void removeTopic(java.lang.String topicName)