com.tibco.bpm.web.client.model.pagebus
Class PageBus

java.lang.Object
  extended by com.tibco.bpm.web.client.model.pagebus.PageBus

public class PageBus
extends java.lang.Object

The PageBus class provides a GWT JSNI interface to the TIBCO PageBus(TM) version 2.0.0 Simple PageBus API.

The Simple PageBus API provides a fast, simple publish-subscribe engine. It does not implement containers or security. The ManagedHub classes can be used when containers and security is required. The Simple PageBus API does support the PageBus Event Cache.

©2011 Cloud Software Group, Inc.

Since:
1.2.0
See Also:
ManagedHub, ManagedHubFrame

Constructor Summary
PageBus()
           
 
Method Summary
static void publish(java.lang.String topic, java.lang.Object message)
          Deprecated.  
static void publish(java.lang.String topic, PageBusMessage message)
          Publishes one message on a topic.
static PageBusMessage[] query(java.lang.String topic)
           
static void store(java.lang.String topic, PageBusMessage message)
           
static Subscription subscribe(java.lang.String topic, OnDataCallback onDataCallback, SubscriberData subscriberData)
          Creates a subscription to a topic name.
static Subscription subscribe(java.lang.String topic, SubscriberCallback subscriberCallback)
          Deprecated.  
static void unsubscribe(Subscription subscription)
          Cancels a subscription, using the Subscription returned by PageBus.subscribe as a handle to the subscription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageBus

public PageBus()
Method Detail

publish

public static void publish(java.lang.String topic,
                           PageBusMessage message)
Publishes one message on a topic. The message is delivered to all current subscribers whose subscriptions match the topic.

If there are multiple subscribers, the order in which the message is delivered to the various subscribers is arbitrary.

If PageBus.publish is called twice, so that two messages are published in sequence, then subscribers will always receive the message that was published first before they receive the second message.

All PageBus functions can be safely called from within PageBus callback functions.

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.
Throws:
BadParametersException - An invalid topic was specified. A topic may be invalid either because it is not a legal topic name or because it is a wildcard topic.

subscribe

public static Subscription subscribe(java.lang.String topic,
                                     OnDataCallback onDataCallback,
                                     SubscriberData subscriberData)
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.

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.

Parameters:
topic - Topic name on which to subscribe. This MAY be a wildcard topic.
onDataCallback - Callback function for PageBus to invoke when a message is published on the subscribed subject. This parameter must NOT be null.
subscriberData - User-defined. Null values are 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:
Subscription containing opaque JavaScript subscription ID string.
Throws:
BadParametersException - An illegal topic was specified.

unsubscribe

public static void unsubscribe(Subscription subscription)
Cancels a subscription, using the Subscription returned by PageBus.subscribe as a handle to the subscription.

The unsubscribe function can be safely called from within PageBus callback functions.

If a cache-enabled subscription is unsubscribed, and that subscription is the last one using a particular event cache, then the event cache is automatically destroyed.

Parameters:
subscription - Subscription returned by PageBus.subscribe.
Throws:
BadParametersException - The parameter is not a valid subscription.

query

public static PageBusMessage[] query(java.lang.String topic)
See Also:
EventCache.query(JavaScriptObject, String)

store

public static void store(java.lang.String topic,
                         PageBusMessage message)
See Also:
EventCache.store(JavaScriptObject, String, PageBusMessage)

subscribe

public static Subscription subscribe(java.lang.String topic,
                                     SubscriberCallback subscriberCallback)
Deprecated. 

Provides backwards compatibility to the PageBus version 1.2 interface.


publish

public static void publish(java.lang.String topic,
                           java.lang.Object message)
Deprecated. 

Provides backwards compatibility to the PageBus version 1.2 interface.



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