Class InterApplicationBus


  • public class InterApplicationBus
    extends java.lang.Object
    A messaging bus that allows for pub / sub messaging between different applications. Available via getInterApplicationBus() method on DesktopConnection
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSubscribeListener​(SubscriptionListener listener)
      Registers a listener which is called whenever a subscription occurs.
      void publish​(java.lang.String topic, java.lang.Object message)
      Publishes a message to a topic
      void publish​(java.lang.String topic, java.lang.Object message, AckListener callback)
      Publishes a message to a topic
      void removeSubscribeListener​(SubscriptionListener listener)
      Removes the passed listener.
      void send​(java.lang.String destinationUuid, java.lang.String topic, java.lang.Object message)
      Sends a message to an application
      void send​(java.lang.String destinationUuid, java.lang.String topic, java.lang.Object message, AckListener listener)
      Sends a message to an application
      void subscribe​(java.lang.String sourceUuid, java.lang.String topic, BusListener listener)
      Subscribes to messages on the specified topic
      void subscribe​(java.lang.String sourceUuid, java.lang.String topic, BusListener listener, AckListener callback)
      Subscribes to messages on the specified topic
      void unsubscribe​(java.lang.String sourceUuid, java.lang.String topic, BusListener listener)
      Unsubscribes to messages on the specified topic
      void unsubscribe​(java.lang.String sourceUuid, java.lang.String topic, BusListener listener, AckListener callback)
      Unsubscribes to messages on the specified topic
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InterApplicationBus

        public InterApplicationBus​(DesktopConnection desktopConnection)
        Constructor
        Parameters:
        desktopConnection - Connection object to the AppDesktop
    • Method Detail

      • publish

        public void publish​(java.lang.String topic,
                            java.lang.Object message)
                     throws DesktopException
        Publishes a message to a topic
        Parameters:
        topic - Topic to which the message is published
        message - The JSON message to publish *
        Throws:
        DesktopException - if this method fails to publish a message
        See Also:
        DesktopException
      • publish

        public void publish​(java.lang.String topic,
                            java.lang.Object message,
                            AckListener callback)
                     throws DesktopException
        Publishes a message to a topic
        Parameters:
        topic - Topic to which the message is published
        message - The JSON message to publish *
        callback - AckListener for the request
        Throws:
        DesktopException - if this method fails to publish a message
        See Also:
        DesktopException
      • send

        public void send​(java.lang.String destinationUuid,
                         java.lang.String topic,
                         java.lang.Object message)
                  throws DesktopException
        Sends a message to an application
        Parameters:
        destinationUuid - UUID of the application from which messages are sent
        topic - Topic to which the message is published
        message - The JSON message to publish
        Throws:
        DesktopException - if this method fails to send a message
        See Also:
        DesktopException
      • send

        public void send​(java.lang.String destinationUuid,
                         java.lang.String topic,
                         java.lang.Object message,
                         AckListener listener)
                  throws DesktopException
        Sends a message to an application
        Parameters:
        destinationUuid - UUID of the application from which messages are sent
        topic - Topic to which the message is published
        message - The JSON message to publish
        listener - AckListener for the message
        Throws:
        DesktopException - if this method fails to send a message
        See Also:
        DesktopException
      • subscribe

        public void subscribe​(java.lang.String sourceUuid,
                              java.lang.String topic,
                              BusListener listener)
                       throws DesktopException
        Subscribes to messages on the specified topic
        Parameters:
        sourceUuid - The UUID of the application to which to subscribe. The wildcard "*" can be used to receive messages from all applications
        topic - The topic to be subscribed to
        listener - BusListener for the subscription
        Throws:
        DesktopException - if this method fails to subscribe to a topic
        See Also:
        BusListener, DesktopException
      • subscribe

        public void subscribe​(java.lang.String sourceUuid,
                              java.lang.String topic,
                              BusListener listener,
                              AckListener callback)
                       throws DesktopException
        Subscribes to messages on the specified topic
        Parameters:
        sourceUuid - The UUID of the application to which to subscribe. The wildcard "*" can be used to receive messages from all applications
        topic - The topic to be subscribed to
        listener - BusListener for the subscription
        callback - AckListener for the message
        Throws:
        DesktopException - if this method fails to subscribe to a topic
        See Also:
        BusListener, AckListener, DesktopException
      • unsubscribe

        public void unsubscribe​(java.lang.String sourceUuid,
                                java.lang.String topic,
                                BusListener listener)
                         throws DesktopException
        Unsubscribes to messages on the specified topic
        Parameters:
        sourceUuid - UUID of the application
        topic - The topic to be subscribed to
        listener - BusListener for the subscription
        Throws:
        DesktopException - if this method fails to unsubscribe a topic
        See Also:
        BusListener, DesktopException
      • unsubscribe

        public void unsubscribe​(java.lang.String sourceUuid,
                                java.lang.String topic,
                                BusListener listener,
                                AckListener callback)
                         throws DesktopException
        Unsubscribes to messages on the specified topic
        Parameters:
        sourceUuid - UUID of the application
        topic - The topic to be subscribed to
        listener - BusListener for the subscription
        callback - AckListener for the message
        Throws:
        DesktopException - if this method fails t unsubscribe a topic
        See Also:
        BusListener, AckListener, DesktopException
      • addSubscribeListener

        public void addSubscribeListener​(SubscriptionListener listener)
        Registers a listener which is called whenever a subscription occurs. A function that is called whenever a subscription occurs. It is passed the topic and application UUID that trigered the event.
        Parameters:
        listener - Listener to add
      • removeSubscribeListener

        public void removeSubscribeListener​(SubscriptionListener listener)
        Removes the passed listener. It is no longer called for subscription events.
        Parameters:
        listener - Listener to remove