com.openfin.desktop
Class InterApplicationBus

java.lang.Object
  extended by com.openfin.desktop.InterApplicationBus

public class InterApplicationBus
extends Object

A messaging bus that allows for pub / sub messaging between different applications. Available via getInterApplicationBus() method on DesktopConnection


Constructor Summary
InterApplicationBus(DesktopConnection desktopConnection)
          Constructor
 
Method Summary
 void addSubscribeListener(SubscriptionListener listener)
          Registers a listener which is called whenever a subscription occurs.
 void publish(String topic, Object message)
          Publishes a message to a topic
 void publish(String topic, Object message, AckListener callback)
          Publishes a message to a topic
 void removeSubscribeListener(SubscriptionListener listener)
          Removes the passed listener.
 void send(String destinationUuid, String topic, Object message)
          Sends a message to an application
 void send(String destinationUuid, String topic, Object message, AckListener listener)
          Sends a message to an application
 void subscribe(String sourceUuid, String topic, BusListener listener)
          Subscribes to messages on the specified topic
 void subscribe(String sourceUuid, String topic, BusListener listener, AckListener callback)
          Subscribes to messages on the specified topic
 void unsubscribe(String sourceUuid, String topic, BusListener listener)
          Unsubscribes to messages on the specified topic
 void unsubscribe(String sourceUuid, 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(String topic,
                    Object message)
             throws DesktopIOException,
                    DesktopException
Publishes a message to a topic

Parameters:
topic - Topic to which the message is published
message - The JSON message to publish *
Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

publish

public void publish(String topic,
                    Object message,
                    AckListener callback)
             throws DesktopIOException,
                    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:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

send

public void send(String destinationUuid,
                 String topic,
                 Object message)
          throws DesktopIOException,
                 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:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

send

public void send(String destinationUuid,
                 String topic,
                 Object message,
                 AckListener listener)
          throws DesktopIOException,
                 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:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

subscribe

public void subscribe(String sourceUuid,
                      String topic,
                      BusListener listener)
               throws DesktopIOException,
                      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:
DesktopIOException
DesktopException
See Also:
BusListener, DesktopIOException, DesktopException

subscribe

public void subscribe(String sourceUuid,
                      String topic,
                      BusListener listener,
                      AckListener callback)
               throws DesktopIOException,
                      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:
DesktopIOException
DesktopException
See Also:
BusListener, AckListener, DesktopIOException, DesktopException

unsubscribe

public void unsubscribe(String sourceUuid,
                        String topic,
                        BusListener listener)
                 throws DesktopIOException,
                        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:
DesktopIOException
DesktopException
See Also:
BusListener, DesktopIOException, DesktopException

unsubscribe

public void unsubscribe(String sourceUuid,
                        String topic,
                        BusListener listener,
                        AckListener callback)
                 throws DesktopIOException,
                        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:
DesktopIOException
DesktopException
See Also:
BusListener, AckListener, DesktopIOException, 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


Copyright © 2016. All rights reserved.