Lua Services

Introduction

A Lua service is the inbound point which triggers the execution of a Lua script within the LogicApp application, in response to a new inbound transaction initiated by some external entity.

The Lua Service is responsible for the setup and tear-down of a LogicApp script instance:

Since the service implements all of the underlying infrastructure, the Lua script needs only to perform the business logic:

  1. Process the arguments which are provided to it.
  2. Return some final result.
  3. Call supplementary Lua Service actions (if required).
  4. Call other Lua Agent functions (if required).

This Technical Guide describes the core Lua Services provided as part of the base n2svcd package. Other protocol-specific Services are delivered by other packages, e.g. Services related to SIP functionality are delivered by the n2sip package.

Configuring Services

Each Service must be configured within the LogicApp, within the <config><services> element, each Service is a separate <service> definition.

Each Service running within the LogicApp is associated with a single inbound message name.
When the LogicApp receives a new inter-application message of that name, it will look down the configured list of Services and offer the message to each Service which is associated with that message name.

Each Service will be given the chance to claim the message. If a Service does not claim the message (e.g. because it has no matching <triggers>) then it can decline the message, which will allow the LogicApp to offer it to any other Services further down the list.

For example:

Service Actions

Each script is initiated by a single Service library, initiated by some received message or event. That service will typically offer additional actions that the script can use to perform interactions during the processing.

For example:

Agent Actions

In addition to the actions provided by a services, the Lua script may freely call upon Lua Agents to perform its work.

Any actions supplied by agents are independent from the actions provided by the script’s Service.