To receive event messages a consumer will need to subscribe to events they want to receive. The flow of event messages from publishers to subscribers is described on the Messaging Architecture Overview page.
Types of Subscription
Explicit Subscriptions
An explicit subscription relates to where a subscriber wishes to receive event messages for a specific patient, for example, a Pharmacist wishing to receive hospital admission and discharge events for a specific Patient.
Explicit subscriptions SHOULD only be active for patients under the subscribing organisations direct care. Explicit subscriptions for a patient should be stopped when the patient leaves the subscribing organisations direct care. This can be done either by removing the explicit subscription using the Delete Subscription API interaction or by including the end
element as part of the subscription resource.
Rule-Based (Generic) Subscriptions
Rule-based subscriptions relate to where a subscriber wishes to receive events that meet a particular rule set rather than for a specific patient. There is currently two specific types of rule-based subscriptions:
-
Geographical: Subscriptions that relate to individuals who lives in a defined area or is registered with a GP that is located within the geographic boundaries of a specific organisation (For example, a Health Visiting Service wishing to view events for all children within a specific local authorities area of responsibility).
A geographical rule based subscription will result in a subscriber receiving events for any patients within the specified geographical area, therefore a subscriber wishing to use this form of subscription must have a legitimate relationship with all patients in the area. If a provider is only responsible for a subset of patients within a geographical area, then geographical subscriptions are not appropriate as the provider will receive information for patients with which they do not have a legitimate relationship. In this scenario the provider should use explicit subscriptions to receive events for the patients with which they have a legitimate relationship.
-
Registered Org: Subscriptions that relate to individuals who are registered with a specific organisation (currently only applicable for GP organisations).
The following rule types are currently available for use within Generic Rule Based Subscriptions:
Patients Postcode within ICB sub location area of responsibility
The NEMS matches the patients home postcode, from their PDS record, to a specific ICB sub location based on the areas of responsible for the different ICB sub location. The NEMS then looks for generic subscription rules which contain a ICB sub location code that matches the ICB sub location responsible for the area in which the patients postcode resides. A copy of the event message is sent to the mailboxes specified in those matching generic subscriptions.
Patients Registered GPs is a child of the ICB sub location
The NEMS looks up the patients registered GP within their PDS record, then finds the parent ICB sub location for that GP practice. The NEMS checks the generic subscriptions for any rules which contain an ICB sub location code that matches the ICB parent of the patients GP, a copy of the event message is sent to the mailboxes specified in those matching generic subscriptions.
Patients Registered GP Code matches GP Code
The NEMS matches the patients registered GP Code, from their PDS record, to generic subscription rules which contain the same GP Code. A copy of the event message is sent to the mailboxes specified in those matching generic subscriptions.
Patients Postcode within LAs area of responsibility
The NEMS matches the patients home postcode, from their PDS record, to a specific LA based the areas of responsible for the different LAs. The NEMS then looks for generic subscription rules which contain an LA Code that matches the LA responsible for the area in which the patients postcode resides. A copy of the event message is sent to the mailboxes specified in those matching generic subscriptions.
All Patients in Country
The NEMS matches the patients home postcode, from their PDS record, to the country specified in the subscription. A copy of the event message is sent to the mailboxes specified in those matching generic subscriptions.
Examples
The following diagram and table demonstrates the way in which generic subscription rules work:
- the circles on the diagram represent the areas of responsibility for the different ICB sub locations and LA
- the location of the stick men and GP practices represents where they are located within the area of responsibility for the ICBs and LA, e.g. where a stick man is within a circle it means that they live within the area of responsibility for that ICB sub location and/or LA
Subscription Rule | Patients Postcode within ICB sub location area of responsibility | Patients Registered GPs is a child of the ICB sub location | Patients Registered GP Code matches GP Code | Patients Postcode within LAs area of responsibility | All Patients in Country |
---|---|---|---|---|---|
Rule Name | CHO_POSTCODE_CCG | CHO_GP_CCG | GP_GP_GP | UHV_POSTCODE_LACODE | COUNTRYCODE |
|
ICBCode1 ICBCode2 |
ICBCode1 ICBCode2 |
GP 1 GP 2 GP 3 GP 4 |
LACode1 | England |
Managing Subscriptions
Subscriptions can be created using the Subscription API Create Subscription interaction. The organizations MESH mailbox must be configured to receive the required event message types as per the requirements on the Event Receiver Requirements page.
Subscription matching and message delivery
Multiple matched subscriptions
A subscriber may create a number of different subscriptions, some explicit and some generic. If an event message published to the National Events Management Service (NEMS) matches the criteria of multiple subscriptions for a single receiving MESH mailbox, the NEMS will only send one copy of the event message to the receiving mailbox.