com.tibco.bpm.web.client.model.pagebus.hub
Class ManagedEventClient

java.lang.Object
  extended by com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
      extended by com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventClient

public abstract class ManagedEventClient
extends ManagedEventService

Encapsulates the details of creating an IframeHubClient and adding subscribers, events, and handlers.

©2012 Cloud Software Group, Inc.

Since:
2.0.0

Field Summary
 
Fields inherited from class com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
onSubscribeCompleteCallback, subscriptions
 
Constructor Summary
protected ManagedEventClient()
          Creates a ManagedEventClient using a default serviceId set to: "ManagedEventClient"
protected ManagedEventClient(java.lang.String serviceId)
          Creates a ManagedEventFrame.
 
Method Summary
 Subscription addSubscriber(java.lang.String topic, OnDataCallback onDataCallback, OnSubscribeCompleteCallback onSubscribeCompleteCallback, SubscriberData subscriberData)
          Creates a subscription to a topic name.
 Subscription addSubscriberNative(java.lang.String topic, com.google.gwt.core.client.JavaScriptObject onDataCallback, com.google.gwt.core.client.JavaScriptObject onSubscribeCompleteCallback, com.google.gwt.core.client.JavaScriptObject subscriberData)
          Creates a subscription to a topic name using native JSO arguments.
 void disconnect()
          Disconnects the IframeHubClient.
 boolean isConnected()
          Returns true if the IframeHubClient is connected.
protected  void onConnectComplete(java.lang.Object item, boolean success, java.lang.String error)
          Extending class can override this as needed to perform specific tasks after a connect completes.
protected  void onCreateSecurityAlert(java.lang.Object source, java.lang.String alertType)
          Extending class can override this as needed to perform specific tasks when a SecurityAlert is encountered.
protected  void onDisconnectComplete(java.lang.Object item, boolean success, java.lang.String error)
          Extending class can override this as needed to perform specific tasks after a disconnect completes.
protected  void onManagedEventBusError(ManagedEventBusError managedEventBusError)
          Extending class can override this as needed to perform specific tasks when a ManagedEventBusError is encountered.
protected  void onReconnectComplete(java.lang.Object item, boolean success, java.lang.String error)
          Extending class can override this as needed to perform specific tasks after a reconnect completes.
 void publish(PageBusMessage message)
          Publishes the given message.
 void publish(java.lang.String topic, PageBusMessage message)
          Publishes the given message using the given topic.
 void reconnect()
          Reconnects the IframeHubClient.
 void removeSubscriber(Subscription subscription)
          Removes the given subscription.
 void removeSubscribers()
          Removes subscriptions previously added and clears the subscriptions set.
 
Methods inherited from class com.tibco.bpm.web.client.model.pagebus.hub.ManagedEventService
addEvent, addEvents, addHandler, addHandlers, addSubscribers, alertMessage, getServiceId, log, onRemoveSubscriberComplete, removeEvents, removeHandlers, setServiceId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedEventClient

protected ManagedEventClient()
Creates a ManagedEventClient using a default serviceId set to: "ManagedEventClient"


ManagedEventClient

protected ManagedEventClient(java.lang.String serviceId)
Creates a ManagedEventFrame.

Parameters:
serviceId - May be used in alert messages or logs to identify the service instance.
Method Detail

removeSubscribers

public void removeSubscribers()
Removes subscriptions previously added and clears the subscriptions set. The ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String) method is called for each callback when the unsubscribe action is complete.

Specified by:
removeSubscribers in class ManagedEventService
See Also:
ManagedEventService.addSubscribers(), ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String)

removeSubscriber

public void removeSubscriber(Subscription subscription)
Description copied from class: ManagedEventService
Removes the given subscription. The ManagedEventService.onRemoveSubscriberComplete(Subscription, boolean, String) method is called for each callback when the unsubscribe action is complete.

Specified by:
removeSubscriber in class ManagedEventService

publish

public void publish(PageBusMessage message)
Description copied from class: ManagedEventService
Publishes the given message. The message is delivered to all current subscribers whose subscriptions match the topic that is set on the message.

Specified by:
publish in class ManagedEventService
Parameters:
message - Message to be published on the given topic.

publish

public void publish(java.lang.String topic,
                    PageBusMessage message)
Description copied from class: ManagedEventService
Publishes the given message using the given topic. The topic value will be set on the message. The message is delivered to all current subscribers whose subscriptions match the topic.

Specified by:
publish in class ManagedEventService
Parameters:
topic - Topic name on which to publish the message. This must NOT be a wildcard topic.
message - Message to be published on the given topic.

isConnected

public boolean isConnected()
Returns true if the IframeHubClient is connected.

Returns:

disconnect

public void disconnect()
Disconnects the IframeHubClient. All subscribers, events, and handlers are removed. The onDisconnectComplete(Object, boolean, String) method is called when the asynchronous callback is made after the disconnect completes.


reconnect

public void reconnect()
Reconnects the IframeHubClient. The onReconnectComplete(Object, boolean, String) method is called when the asynchronous callback is made after the reconnect completes.


addSubscriber

public Subscription addSubscriber(java.lang.String topic,
                                  OnDataCallback onDataCallback,
                                  OnSubscribeCompleteCallback onSubscribeCompleteCallback,
                                  SubscriberData subscriberData)
Description copied from class: ManagedEventService
Creates a subscription to a topic name. When an event is published on a topic name that matches the specified topic, the given onDataCallback is invoked.

The subscription is added to a set of subscriptions that is used to remove the subscription when ManagedEventService.removeSubscribers() is called.

If the subscription's topic name contains wildcards, then the subscriber will be notified via its onDataCallback if the wildcard topic associated with the subscription matches the topic of the published event, even if the two topics are not identical. For example, if a subscriber subscribes to "a.b.*", then it will be notified when someone publishes on the topic "a.b.c" or the topic "a.b.x".

The value of the subscriberData parameter determines whether the subscriber is cache-enabled.

Specified by:
addSubscriber in class ManagedEventService
Parameters:
topic - Topic name on which to subscribe. This MAY be a wildcard topic.
onDataCallback - Callback function for ManagedEventService to invoke when a message is published on the subscribed subject. This parameter must NOT be null.
onSubscribeCompleteCallback - Callback function for ManagedEventService to invoke after the subscription has been added. Optional, null value is permitted.
subscriberData - User-defined. Null value is permitted. This is useful when the subscriber needs to access or update any data members when the callback function is invoked. The value of the subscriberData parameter determines whether the subscriber is cache-enabled.
Returns:
The Subscription created. This can be used with removeSubscriber(Subscription).
See Also:
ManagedEventService.removeSubscriber(Subscription)

addSubscriberNative

public Subscription addSubscriberNative(java.lang.String topic,
                                        com.google.gwt.core.client.JavaScriptObject onDataCallback,
                                        com.google.gwt.core.client.JavaScriptObject onSubscribeCompleteCallback,
                                        com.google.gwt.core.client.JavaScriptObject subscriberData)
Description copied from class: ManagedEventService
Creates a subscription to a topic name using native JSO arguments.

Specified by:
addSubscriberNative in class ManagedEventService
Returns:
See Also:
ManagedEventService.addSubscriber(String, OnDataCallback, OnSubscribeCompleteCallback, SubscriberData)

onDisconnectComplete

protected void onDisconnectComplete(java.lang.Object item,
                                    boolean success,
                                    java.lang.String error)
Extending class can override this as needed to perform specific tasks after a disconnect completes.

Parameters:
item -
success -
error -

onReconnectComplete

protected void onReconnectComplete(java.lang.Object item,
                                   boolean success,
                                   java.lang.String error)
Extending class can override this as needed to perform specific tasks after a reconnect completes. The base method adds the subscribers, events, and handlers.

Parameters:
item -
success -
error -

onConnectComplete

protected void onConnectComplete(java.lang.Object item,
                                 boolean success,
                                 java.lang.String error)
Extending class can override this as needed to perform specific tasks after a connect completes.

Parameters:
item -
success -
error -

onManagedEventBusError

protected void onManagedEventBusError(ManagedEventBusError managedEventBusError)
Extending class can override this as needed to perform specific tasks when a ManagedEventBusError is encountered.

Parameters:
managedEventBusError -

onCreateSecurityAlert

protected void onCreateSecurityAlert(java.lang.Object source,
                                     java.lang.String alertType)
Extending class can override this as needed to perform specific tasks when a SecurityAlert is encountered.

Parameters:
source -
alertType -


Copyright © 2015 Cloud Software Group, Inc. All Rights Reserved.