After adding events to the mini-bundle and generating the relevant Java enums file from it, you can start to add data sending logic in your code.

To send data, you need to create or get a trail first. The SAS facility creates trails either explicitly, when a resource adaptor calls startTrail() or implicitly, when a resource adaptor or service calls getOrCreateTrail() with an activity reference. Trails typically last the lifetime of an activity. Multiple activities may share the same trail. For example, a database lookup in a call setup uses the trail of the SIP dialog or transaction.

You can use the methods provided by the SasFacility interface to create or get a trail. For example, the getTrail() method enables you to get the trail attached to an activity.

When a SLEE event is delivered to a service, the invoking trail is available through an invoking trail accessor, which you can get by calling the getInvokingTrail() method of the InvokingTrailAccessor class. The method returns the SAS trail attached to the activity context interface (ACI) on which the event was fired. On subsequent down calls that result in a new SLEE activity being created, the invoking trail is automatically attached to the new activity. This can save you from having to add code that explicitly gets a trail from the invoking ACI and attaches it to a new ACI. If necessary, you can call the setInvokingTrail(Trail) or remove() method to manually set or clear the invoking trail.

The following example code shows how to get the invoking trail from an invoking trail accessor:

Trail trail = InvokingTrailAccessor.getInvokingTrail();

Once you have a trail, you can use it to create API messages and send data to SAS.

With a trail, you can send two types of data:

  • Send event data by adding events that you defined in the mini-bundle to the trail.

  • Send marker data by adding predefined markers with appropriate values to the trail.

Note The objects and methods for creating and sending API messages are defined in the Java library rhino-extensions.jar. Make sure that you include this library in your class path.
Previous page Next page