EVENT_PUBLISH (Publish Event to Subscribers)

Publishes an event to subscribers of the specified channel

Syntax

CALL EVENT_PUBLISH(eventId, publishType, rc,properties,
<propValue1, …propValueN> , channel);

Required Arguments

eventID
specifies the event that is to be published.
Type:Numeric, Input
publishType
indicates how to publish the event. To publish an event to the subscribers of a channel, specify a publishType value of TO_SUBSCRIBERS.
Type:Character, Input
rc
receives a return code.
Type:Numeric, Output
properties
specifies the following property name, or specifies double quotation marks to indicate that the property is not to be applied:
  • CHANNEL_STORE
  • FOLDER_PATH
  • SELECTOR
Type:Character, Input
propValue1, …propValueN
specifies one value for each specified property name. Valid property values are defined as follows:
CHANNEL_STORE specifies a character string that indicates the SAS Metadata Repository that contains the channel and subscriber metadata. If channel definitions and subscriber definitions are maintained in a SAS Metadata Repository, then the syntax for the CHANNEL_STORE property is as follows: SAS-OMA://hostname[:port/reposname=repositoryName; Where hostname is the name of SAS Metadata Server that contains channel information. HOSTNAME must be a DNS name or IP address of a host that is running a SAS Metadata Server. The port specifies the TCP port of the SAS Metadata Server. If no port is specified, then 8561 is used as a default. The reposname is the name of the repository.
FOLDER_PATH specifies the folder path for the channel of interest. This value is used to search for channels with specific names that exist in specific folder locations. When a user defines a channel via SAS Management Console, all channels by default exist in the /Channels folder. SAS Management Console allows the user to define multiple folders and subfolders. All FOLDER_PATH properties must start with /Channels and then can identify subfolders if necessary. For example, a channel named "Sales" might be defined in two different folders: /Channels/Reports/US/ or /Channels/Reports/Europe/.
SELECTOR specified on the CALL routine, it identifies the name/value properties to define on the event messages that are published. These properties can be used by the Event Broker to determine what messages should be removed from the queue. The Event Broker can be configured so that it removes only messages from the queue that match particular name/value selectors. If the Event Broker configures selectors, then only messages that have properties that match the configured selector are delivered to the Event Broker. Other messages remain on the queue.
Type:Character or Numeric, Input
channel
specifies the name of the channel where the event will be published.
Type:Character, Input

Details

When an event is published to a channel, the event is published to each subscriber of the channel. Each subscriber definition specifies the event publishing transport method to use for the subscriber. Valid transports are HTTP and message queues.
PUBLISH_EVENT ensures that the event is published to each subscriber only once, thus eliminating any duplication. For the message queue transport, the name of the queue is used as the key to enforce uniqueness. For an HTTP server transport, the URL is used as the key to enforce uniqueness.
Publishing an event to subscribers does not support the RESPONSE property.

Example: Publishing an Event to Subscribers

The following example publishes the event to all subscribers of the WeeklyPayroll channel:
channelStore =
   "SAS-OMA://alpair03.sys.com:4059";
channelName = "WeeklyPayroll";
prop = "CHANNEL_STORE,METAUSER,METAPASS";
user = "myUserName";
password = "myPassword";
CALL EVENT_PUBLISH(eventId, "TO_SUBSCRIBERS",
   rc, prop, channelStore, user, password, channelName);