Sample programs that can be used to demonstrate and test the firing of events on various transports.

Samples

Overview

Setup

Process Flow samples

Application listener samples

Overview

This package which is located in sas.svc.events.jar includes sample programs that send events to an EventBroker service for demonstration and testing purposes.

Setup

Deployment

Refer to this document for deployment details. A sample deployment file, deployment.xml, is included in this package. This Foundation Service deployment file can be imported into a SAS Metadata Repository using the Foundation Service Manager Plug-in component of the SAS Management Console.

If you will be using the StoredProcess samples, you must edit the InformationService repository definitions by editing the Host, Port, Domain, and Base definitions for each repository (omi, dav). For example the Sample repository should contain the following values: Host="host where the SAS Metadata Repository is running", Port="port where the SAS Metadata Repository is listening", Domain="authentication domain in which the SAS Metadata Repository is running". The webDAV repository should contain the following values: Host="host where the webDAV server is running", Port="port where the webDAV server is listening", Domain="authentication domain in which the webDAV server is running", Base="the webDAV base path". You must also edit the UserService global profile by specifying the appropriate Domain URL to designate where to store global profile information (most likely in the Sample omi repository).

Define User metadata

Define users if events will be run under a security context. Refer to security considerations for more detail. This step is necessary if you will be using the StoredProcess samples.

Use the User Manager Plug-in component of the SAS Management Console to define new users.

Define StoredProcess metadata

Before running the StoredProcess samples you will need to define a StoredProcess Server using the Server Manager Plug-in component of the SAS Management Console.

You will also need to define the individual StoredProcess samples using the Stored Process Manager Plug-in component of the SAS Management Console. You can use the LoadStoredProcessSamples.sas program to load the stored process samples. However, you still must fully configure these stored processes by associating them to the appropriate SAS StoredProcess Server and source directory.

Process Flow samples

Process flows are one type of handling agent that can process events.

HelloWorld

HelloWorld is a very simple request/response event. When this event is triggered at an event broker, it will invoke the HelloWorldFlow process flow. This process flow contains only one node that simply echos the incoming event properties and event body in the returned result.

To demonstrate the firing of this event, the following samples are provided:

ProfitLoss

ProfitLoss is a more complex request/response event that demonstrates message manipulation and propagation. The idea behind this event is to analyze sales regions in a particular company to determine if the actual sales in a region exceeded the projected outcome. When this event is triggered at an event broker, it will invoke the ProfitLossFlow process flow. This process flow contains five processing nodes. The first node demonstrates the use of properties by obtaining the Company property from the event properties and using its value as the name of the company to analyze. This node will then create a new message that contains only a subset of information from the original message that pertains to the desired company to analyze and propagates this message to the next node in the flow. This next node will then determine the regions that are profitable and the regions that are not profitable. It will then create two messages: one message containing profitable regions and the other containing non-profitable regions. It will then propagate these messages to different nodes for further processing. ProfitLossFlowNode3 processing node will receive the message containing profitable regions. This node will create a new message that summarizes the profitable regions and their total profitability. This output message is then propagated to the final processing node, ProfitLossFlowNode5. Likewise, ProfitLossFlowNode4 processing node will receive the message containing regions with losses. This node will create a new message that summarizes the regions with losses and their total net loss. This output message is also propagated to the final processing node, ProfitLossFlowNode5. The final processing node will join the information it receives from its two input messages and send the result back to the event originator as the response.

To demonstrate the firing of this event, the following samples are provided:

ProductSales

ProductSales is a stored process request/response event. When this event is triggered at an event broker, it will invoke the ProductSalesFlow process flow. This process flow contains a single node, ExecuteSPNode, that invokes the productsales.sas stored process on the designated SAS StoredProcess Server. The input to this stored process is the name of the country and year that you are interested in analyzing. The resulting dataset is the response that is sent to the event orginator.

The ExecuteSPNode processing node must be run under a security context. Therefore, appropriate credentials must be passed with the event so that they may be authenticated and used as the security context.

To demonstrate the firing of this event, the following samples are provided:

ProductSalesAlert

ProductSalesAlert is another stored process request/response event. When this event is triggered at the event broker, it will invoke the ProductSalesAlertFlow process flow. This process flow contains a single node, ExecuteSPAlertNode, that invokes the productsales.sas stored process on the designated SAS StoredProcess Server. The input to this stored process is the name of the country and year that you are interested in analyzing. The resulting dataset is published to the designated webDAV server and an alert detailing this process is sent to the event originator.

The ExecuteSPAlertNode processing node must be run under a security context. Therefore, appropriate credentials must be passed with the event so that they may be authenticated and used as the security context.

To demonstrate the firing of this event, the following samples are provided:

Application listener samples

Application listeners are one type of handling agent that can process events.

ListenerTest

Start com.sas.services.events.broker.samples.ListenerTest java program to listen for incoming ListenerTest events. This program assumes that an event broker has been deployed as a remoteable service such that it has bound itself to an RMI Registry at the following address: //localhost:1099/com.sas.services.events.broker.EventBrokerService. When this event is triggered at the event broker, it will invoke this listener. This listener will simply reply with the following response if everything works as expected: <ListenerTest>Test was successful.</ListenerTest>

To demonstrate the firing of this event, the following samples are provided: