SPARKL events

In SPARKL, everything happens in the form of an event. These events can be of many different types. For example, if a service is instantiated, a service-up event occurs. If a service implements an operation, a data event occurs.

All event types are logged by SPARKL.

Note: Event logs are not the same as system logs. Only admin users can view system logs - like error reports and supervisor reports.

SPARKL comes bundled with the Logger, a default service for tracing logs and debugging transactions.

Data events

SPARKL uses the operations of a mix to send input to a service or to receive output from a service. All input is sent and all output is received in the form of a data event.

The following six data event types exist in SPARKL:
  • Notify
  • Solicit
  • Response
  • Request
  • Reply
  • Consume

Data events make up the four operations.

A data event can be:

  • Input event
    The event is received by a service (from SPARKL)
  • Output event
    The event is sent by a service (to SPARKL)

A data event can also be:

  • Start event
    An event that starts a new transaction
  • Goal event
    An event that forms a goal of a transaction

Table 1 groups data events by their corresponding operations.

Table 1. Data event types
Event type Corresponding operation Output/input Start/goal Description
Notify Notify Output Start A client service sends a notification to SPARKL to start a new transaction.
Consume Consume Input Goal A service receives data from SPARKL. A consume is a goal event (a transaction can have one or more goals).
Solicit Solicit/response Output Start A client sends a solicit to SPARKL to start a new transaction. The client waits for a response.
Response Solicit/response Input Goal A client receives data from SPARKL. The data forms a response to the initial solicit. A response is a goal event. There can be one or more responses to a solicit.
Request Request/reply Input Neither A service receives input from SPARKL. SPARKL expects a reply.
Reply Request/reply, consume/reply Output Neither A service generates data that forms a reply to a request (or a consume). There can be one or more replies to a request.
Note: A consume/reply is treated much like a request/reply, except that a consume forms a goal event.

Transaction events

This group of events comprises all the data events that make up a transaction, plus the start and end events of the transactions.

The data events always come between the transaction start and end events.

Provisioning events

Provisioning events are sent when a service instance comes up or goes down.

Provisioning events are of two distinct types:

  • Provisioning events
    When a service instance is started, a service_up event is sent.
    When a service instance is stopped, a service_down event is sent.
  • Life-cycle events
    Life-cycle events are optional.
    If a service instance requires initialisation after being brought up, it is sent an open_event.
    If a service instance requires preparation before it is brought down, it is sent a close_event.

State change events

Services can have states. Data events can change these states. A state change can lead to further events.

Service states are defined as state variables on the services. These variables can be updated by certain events.

Note: Not all SPARKL extensions support service states. Out of the core extensions, only the Expressions extension supports stateful services.