Package com.openfin.desktop
Class InterApplicationBus
java.lang.Object
com.openfin.desktop.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
-
Constructor Summary
Constructors Constructor Description InterApplicationBus(DesktopConnection desktopConnection)
Constructor -
Method Summary
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 topicvoid
publish(java.lang.String topic, java.lang.Object message, AckListener callback)
Publishes a message to a topicvoid
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 applicationvoid
send(java.lang.String destinationUuid, java.lang.String topic, java.lang.Object message, AckListener listener)
Sends a message to an applicationvoid
subscribe(java.lang.String sourceUuid, java.lang.String topic, BusListener listener)
Subscribes to messages on the specified topicvoid
subscribe(java.lang.String sourceUuid, java.lang.String topic, BusListener listener, AckListener callback)
Subscribes to messages on the specified topicvoid
unsubscribe(java.lang.String sourceUuid, java.lang.String topic, BusListener listener)
Unsubscribes to messages on the specified topicvoid
unsubscribe(java.lang.String sourceUuid, java.lang.String topic, BusListener listener, AckListener callback)
Unsubscribes to messages on the specified topic
-
Constructor Details
-
InterApplicationBus
Constructor- Parameters:
desktopConnection
- Connection object to the AppDesktop
-
-
Method Details
-
publish
Publishes a message to a topic- Parameters:
topic
- Topic to which the message is publishedmessage
- 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 DesktopExceptionPublishes a message to a topic- Parameters:
topic
- Topic to which the message is publishedmessage
- 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 DesktopExceptionSends a message to an application- Parameters:
destinationUuid
- UUID of the application from which messages are senttopic
- Topic to which the message is publishedmessage
- 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 DesktopExceptionSends a message to an application- Parameters:
destinationUuid
- UUID of the application from which messages are senttopic
- Topic to which the message is publishedmessage
- The JSON message to publishlistener
- 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 DesktopExceptionSubscribes 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 applicationstopic
- The topic to be subscribed tolistener
- 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 DesktopExceptionSubscribes 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 applicationstopic
- The topic to be subscribed tolistener
- BusListener for the subscriptioncallback
- 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 DesktopExceptionUnsubscribes to messages on the specified topic- Parameters:
sourceUuid
- UUID of the applicationtopic
- The topic to be subscribed tolistener
- 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 DesktopExceptionUnsubscribes to messages on the specified topic- Parameters:
sourceUuid
- UUID of the applicationtopic
- The topic to be subscribed tolistener
- BusListener for the subscriptioncallback
- AckListener for the message- Throws:
DesktopException
- if this method fails t unsubscribe a topic- See Also:
BusListener
,AckListener
,DesktopException
-
addSubscribeListener
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
Removes the passed listener. It is no longer called for subscription events.- Parameters:
listener
- Listener to remove
-