Subscribe to Events in an Integration

You can create an integration that subscribes to published events. The subscribing integration event is triggered when the integration publishing the event is run. Multiple integrations can subscribe to the same published event. This section provides an example of how to create a subscription integration.

  1. In the navigation pane, click Design, then Integrations.
  2. Click Create, then select Event.
  3. Complete the fields in the Create integration panel to create the event-based integration. See Create an Integration.
    A Subscribe to event trigger is created and the Choose event panel opens for you to select the event to which to subscribe.

    Note:

    The selected event becomes the trigger for this integration. You do not drag an adapter connection into the integration canvas in event-based integrations to use as a trigger.


    The Subscribe to event icon appears. To Choose event panel is open. It shows a Search field and a Define new event button. Below are the available events from which to choose. The Cancel and Choose buttons appear at the bottom.

  4. Select the event. For this example, Patient Moved is selected. If necessary, you can also define a new event in this panel by selecting Define new event.

    The Choose event panel shows a label of Subscribe to event. The Search field shows a value of patient moved. The Define new event appears on the right. Below this is the Patient Moved event. The View Details icon appears on the right.

  5. Click View details View details icon to view the JSON contents of the event. For this example:
    {
        "patientId": "value1", 
        "fromDept": "value1", 
        "toDept": "value1"
    }
  6. Click Choose this event or click <, then click Choose.
  7. Click Finish.
    The Subscribe to event trigger is updated to include the event that you selected.


    The Subscribe to event icon in the integration canvas is displayed.

  8. Design the remaining parts of the integration. For this example, a logger action is added to the integration canvas and the message is configured to include the parameters defined in the event.
    concat('Patient Id  ', patientId, ' transferred from ', fromDept, ' to ', toDept)


    The Subscribe to event icon and Logger icon are shown. To Configure logger panel is open. The Input sources and Functions tabs are shown. Below this is the Sources section elements. To the right is the Log section (Always button is selected) and the Logger message section, which shows a concat function configured. The configuration is shown above this image.

  9. Define a business identifier for the integration.
    The integration looks as follows:


    The Subscribe to event icon and Logger icon are shown in the integration canvas.

  10. Save and activate the integration. This integration is now ready to subscribe to the Patient Moved event.
  11. Run the integration that publishes the Patient Moved event. Once this integration is run, the event in the subscribing integration is triggered.
    1. In the navigation pane, click Design, then Integrations.
    2. Hover over the publishing integration, and select Actions Actions icon, and then Run.
    3. Specify values for the three parameters in the event file, and click Run.

      The Configure and run page shows the POST value. Below this is the Request section, with tabs for URI parameters, Headers, Body, cURL, and Integration Properties. Below this are the patientID, fromDept, and toDept parameters and their runtime values.

      The activity stream opens and indicates that the Patient Moved event was published.


      The Activity Stream page shows the instance ID at the top. Below this is the Tracing level value of Production. Below this are the milestones in the completed instance. The message was successful published.

  12. In the navigation pane, click Observability, then Integrations.
    The integration that subscribed to the event was triggered and an instance was created and processed successfully.


    The Monitor integrations page shows the Total instance count section at the top. Below this is the search filter. Below this is a table with columns for Name, Received, Processed, Succeeded, Errored, Aborted, and Last scheduled by.

  13. In the navigation pane, click Observability, then Instances.
  14. Hover over the business identifier for the integration instance and click View details View details icon to open the Activity stream panel.
    The subscribing integration successfully subscribed to the event. The logger action message in the activity stream shows that the patient transfer occurred.
    Patient ID 0006 was transferred from surgery to ICU.


    The Instances page shows the search filter. Below this is a table with columns for Primary identifier, Instance ID, Business Identifiers, and Duration. The Activity stream is open to show the instance ID value and the Tracing level set to Production. Below this are the completed milestones in the instance. The Logger is expanded to show the message Patient Id 0006 transferred from Surgery to ICU.

Retain an Event Subscription During Integration Deactivation

You can retain an event subscription when deactivating an integration that subscribes to published events. This action enables you to begin subscribing to published events again when you reactivate the integration.

Note:

For subscribing integrations created in release 23.10 and later, the Delete event subscription check box is visible. For subscribing integrations created prior to release 23.10, there is no check box and you do not have the ability to retain events when deactivating an integration.
  1. In the navigation pane, click Design, then Integrations.
  2. Go to the row of the subscribing integration you want to deactivate.
  3. Click Deactivate Deactivate icon to deactivate the integration.
    You can select whether or not to delete the event subscription.


    The Deactivate integration dialog shows the integration to deactivate. A Delete event subscription check box also appears At the bottom are Cancel and Deactivate buttons. A help icon appears in the upper right.

    Event subscription behavior is based on what you do with the Delete event subscription check box.

  4. If you do not select Delete event subscription, and click Deactivate.

    Note:

    Events expire after 24 hours. Therefore, only events published within one day of the next activation are delivered.
    1. In the navigation pane, click Observability, then Subscriptions.
    2. Note that the deactivated integration appears with the words Configured in the Subscriber status column. If you reactivate the integration, it begins subscribing to events again.
    3. If you want to unsubscribe, hover over the row of the integration, and click X.

      The Unsubscribe icon appears at the far left of the row. To the immediate left is the Subscriber status column.

  5. If you select Delete event subscription, and click Deactivate.
    1. In the navigation pane, click Observability, then Subscriptions.
    2. Note that the deactivated integration does not appear. If you reactivate the integration, it does not subscribe to events again.