Rich UI Infobus

The Rich UI Infobus is a library that makes available a publish-and-subscribe mechanism, which works as follows:

Infobus functions

The following Infobus functions are in use:
  • Infobus.subscribe accepts two arguments: an event name and a reference to the function that the Infobus invokes when the event is published. The event name may include wildcard characters, as described later.
    You must code the function to be invoked. That function is based on the following Delegate part, which indicates that the function can accept whatever type of data you provide when you publish the event:
    InfoBusCallback(eventName String in, data any in) 

    Infobus.subscribe also returns a subscription value (type ANY), which you can use to unsubscribe from the event.

  • Infobus.unsubscribe accepts a single parameter; the value of type ANY returned from Infobus.subscribe. This function has no return value.
  • Infobus.publish accepts two arguments: an event name and the data that you provide. This function has no return value.

If a Rich UI handler subscribes to the Infobus, that handler cannot be removed from memory. For example, if the user’s button click creates a handler in a function, and if the handler subscribes to the Infobus, the handler and its widgets cannot be removed from memory until the handler unsubscribes from the Infobus.

In most cases, memory is freed by the EGL runtime code. However, the following topic describes a case in which you are in greater control of memory management: “Rich UI memory management for Microsoft™ Internet Explorer.”

Event names and wild cards

An event name is composed of one or more tokens—character symbols such as sample and test (in our example). each of which is separated from the next by a dot.

You can use Infobus.subscribe to subscribe to more than one event. Two wildcard characters are available, and you can use both in the same Infobus.subscribe invocation:
  • If an asterisk (*) is used in place of a token, the function registered by Infobus.subscribe is invoked when your code publishes any event whose name matches the event name regardless of the token that you specify in place of the asterisk. For example, if Infobus.subscribe identifies the event name as com.mycompany.update.*.new.employee, the function registered by Infobus.subscribe is invoked in response to any of the following invocations:
    InfoBus.publish("com.mycompany.update.sales.new.employee", "some data");
    
    InfoBus.publish("com.mycompany.update.marketing.new.employee", "some data");
    
    InfoBus.publish("com.mycompany.update.outreach.new.employee", "some data");
  • If a double asterisk (**) is used in place of the last token, the function registered by Infobus.subscribe is invoked when your code publishes any event whose name matches the event name regardless of the series of tokens (and intervening dots) that you specify in place of the asterisk. For example, if Infobus.subscribe identifies the event name as com.mycompany.update.sales.**, the function registered by Infobus.subscribe is invoked in response to any of the following invocations:
    InfoBus.publish("com.mycompany.update.sales.new.employee", "some data");
    
    InfoBus.publish("com.mycompany.update.sales.temporary.employee", "some data");
    
    InfoBus.publish("com.mycompany.update.sales.outreach.new.temporary.employee", "some data");

For additional details

The Infobus mechanism is based on an implementation of the OpenAjax alliance. You may not need further details on this mechanism, but can get them as follows:
  1. Go to the OpenAjax alliance website:

       http://www.openajax.org/index.php

  2. Click Wikis > Member Wiki
  3. Type the following string in the Search field: OpenAjax Hub 1.0 Specification PublishSubscribe

Rich UI does not support the specification phrases related to filter or scope.