Once you have a trail, you can use it to create an API message and send data with the message.

The following example code for call diversion illustrates the steps for sending data with events:

1
2
3
4
5
Trail trail = InvokingTrailAccessor.getInvokingTrail();
EventMessage event = trail.event(SasEvent.DIVERT_CALL);
event.staticParam(diversionTypeToSasType(diversionType));
event.varParam(newTarget);
event.report();

These steps are as follows:

  1. Add an event to the trail with an event message object.

    As shown in line 2, the event() method is used to add the DIVERT_CALL event to the trail.

  2. Assign values to event parameters with an appropriate method.

    As shown in lines 3 and 4, the staticParam() method and the varParam() method are respectively used to add the values.

  3. Send the data out with the report() method.

    As shown in line 5, the report() method of the event message object is used to send the data.

Once you are familiar with the process, you can combine the methods in the same statement. The example code above can also be written as follows:

InvokingTrailAccessor.getInvokingTrail()
    .event(SasEvent.DIVERT_CALL)
    .staticParam(diversionTypeToSasType(diversionType))
    .varParam(newTarget)
    .report();

Add an event to the trail

Once you get a trail, you can add an event that you defined in the mini-bundle to the trail.

Events can be added with the event() method. In this method, you must use the Java enum generated from the mini-bundle to add the relevant event. For example, the following code uses the enum for the SETTING_TIMER event to add the event to a trail:

EventMessage event = trail.event(SasEvent.SETTING_TIMER);

EventMessage is an object type for sending event data to SAS. Each object can have parameters holding information with details about event specifics.

Assign values to event parameters

After adding the event, you can use appropriate methods of the event message object to assign values to event parameters. For example, the following code assigns values to two parameters with the staticParam() method, which assigns a value to a 32-bit fixed-length parameter:

event.staticParam(timerTypes.No_Reply);
event.staticParam(timerValue);
Important The number and type of the parameters that you assign to the event must match the number and type of the parameters that you define for the event in the mini-bundle.

For information about the methods that you can use, see the Rhino Extension API document listed in the Related information section.

Send the data out

Once you have an event message object ready, you can use the report() method to send the relevant data out.

Important The report() method is asynchronous, which means once it is called, the Rhino SAS facility enqueues the message for sending. Make sure the values of the parameters don’t change between their assignments and the actual sending of the data.
Previous page Next page