Natural Access organizes services and their associated resources around a processing object known as a context. Each instance of an application binding to an M3UA NSAP is a unique Natural Access context. Contexts are created with ctaCreateContext.
A Natural Access queue delivers all events and messages from the M3UA layer to the application. Queues are created with ctaCreateQueue. Each context is associated with a single queue through which all events and messages belonging to that context are distributed. More than one context can be assigned to the same queue.
Different application programming models are possible depending on how many M3UA NSAPs (subsystems) are implemented by the application and how the application is organized.
An application that uses a single M3UA NSAP uses a single context, single queue model, as shown in the following illustration:
For a single threaded application that uses multiple M3UA NSAPs (multiple M3UA subsystems), a multiple context, single queue model is recommended. The application has a single event loop with events from all SAPs delivered through the same queue. The application determines which SAP a particular event is associated with from a service user ID (suID) value returned with each event.
The following illustration shows a multiple context, single queue model:
For multi-threaded applications using multiple M3UA NSAPs (one per thread), a multiple context, multiple queue model is recommended. Each thread has its own independent event loop, receiving only the events associated with its M3UA NSAP on its Natural Access queue.
For this programming model, each thread and event queue must be assigned its own entity ID, unique among all applications on that host accessing any of the SS7 services.
The following illustration shows a multiple context, multiple queue model: