$session->subscribe( $C, $I, $E [, $flags ] );
$session->subscribe( "$C::$I::$E[/$flags]" );
$session->unsubscribe( $C, $I, $E [, $flags ] );
$session->unsubscribe( "$C::$I::$E[/$flags]" );

These functions subscribe, or unsubscribe, to notifications of the specified events. “$C”, “$I”, “$E” must be regexp patterns that represent the classes, instances, and events to which to subscribe.

The unsubscribe() function is the inverse of subscribe().

The $flags value is a bitwise combination of the values or a more mnemonic string as shown in Subscription flag parameter values

Table 1. Subscription flag parameter values

Flag bitfield value

Description

0x000001

Simple event

0x000002

Simple aggregation

0x000010

Problem

0x000020

Imported event

0x000040

Propagated aggregation

0x0000ff

All

0x001000

Expand subclasses

0x002000

Expand subclasses events

0x004000

Expand aggregations

0x008000

Expand closures

0x010000

Sticky

0x020000

Undo all

0x040000

Quiet accept

0x080000

Quiet suspend

0x100000

Glob

As a compatibility aid, the $flag can also be specified as a string of letters. In this case, each of the letters are subscription qualifiers:

  • “p” means subscribe to problems

  • “a” means subscribe to aggregates (impacts)

  • “e” means subscribe to events.

    Note:

    If “p”, “a” or “e” are not present, “p” is assumed.

  • “v” means run in verbose mode, which turns on subscription control messages.

    The action of these options is the same as that provided by the sm_adapter program’s --subscribe= option.

    Examples:

     $session->subscribe( "Router", ".*", ".*", "/pev" );
     $session->subscribe( "Router::.*::.*/peav" );
     $session->subscribe( $obj, ".*", 0x3 );
     $session->unsubscribe( $obj, ".*", 0x3 );