Index > Section II – Functional Modules > Functional Modules > Implementation Considerations Bottom of Page
| Genesys 8.0 SCXML Technical Reference
< Events Versioning >

## Implementation Considerations

#### Programming Aspects

The following are some of the critical aspects you must keep in mind when developing a functional module:

- Try and make sure your implementation is as stateless as possible. Stateful information should be kept in the provider's system.
- The functional module is responsible for maintaining the relationship between the SCXML session and the associated functional module actions and objects. This helps the platform deliver the appropriate events to the right SCXML session.
- Try and keep the path length of your actions as short as possible. Also try not to block for long periods of time during the processing of an action.
- HA, scalability and unified single appearance capabilities are the responsibility of the provider's system. The functional module model is a client library which provides access to the system providing the function.
- Functional module developers must explicitly specify for their objects whether they are to be persisted by the orchestration platform or not. The platform default for objects will be "true" (that is, they will be persisted), so it is important to be explicit, because the functional module should not persist objects that are maintained by an external system (that is, any object that is synced with some external system should NOT be persisted, but rather should be restored when the session is re-activated).
- Genesys strongly discourages the exposure of functional module functionality or actions via ECMAScript methods, because it limits your ability to do good validation checking when the document is loaded.

#### Session Processing

A functional module will be directly involved in the processing of SCXML sessions. This involvement occurs throughout the lifecycle of the session and the functional module itself:

- Functional module initialization — The following are the session-specific items that the functional module is responsible for during its initialization process:

- Obtaining the trigger configuration information
- Registering for the trigger-related events from their corresponding system.

- Functional module runtime processing — The following are the session-specific items that the functional module is responsible for:

- Trigger event processing:

- Identify that the event and corresponding conditions match the trigger definition.
- Use the functional module framework interfaces to create a session, based on this trigger event and related entity information.
- When the platform signals that the session has been created, the functional module must create an association between the entity and the session internally. It must also ensure that any events related to this entity should be sent to the associated session via the functional module framework interfaces.
- Handle requests from the session to compile and validate custom actions
- If necessary the functional module must also create an association between the entity and the session in the functional module's external system (for example, for interaction-based triggers, add the session ID to the user data of the interaction).

- General processing:

- Handle custom actions, functions, and object updates from the session.
- Be able to ensure that the all functional module entities (data and events) are available to the session's application for use under all conditions. For example:

- The associated entity moves away from the functional module and then back. For example, if an interaction is sent to an agent (not monitored by the functional module) and the agent sends the interaction back to a resource monitored by the functional module, they should be correlated via the session ID in user data.)
- A new entity is to be associated with the session via an indirect relationship to the original entity. For example, if a new interaction which is a child of an interaction associated with the session is sent to a resource that is monitored by the functional module, they should be correlated via the parent interaction ID).

- Handle platform session persistence requests through the functional module framework interfaces.
- Handle session termination events from the platform.

Index > Section II – Functional Modules > Functional Modules > Implementation Considerations Top of Page
| Genesys 8.0 SCXML Technical Reference
< Events Versioning >