Creating ordered polling notifications

Create an ordered polling notification to retrieve new or updated database records in sequence by using a timestamp or incremental ID. This notification type helps ensure reliable, in-order processing of data changes, making it ideal for scenarios that need strict event sequencing or state tracking.

Before you begin

  • Make sure that the messaging capability is enabled for your webMethods Integration environment.
  • You have the details of the database that you want to connect to, such as user account, driver group, database name, credentials, and server name.
  • The database user must have privileges to create table, trigger, and sequence.

About this task

In this example, an ordered polling notification is created to log a message when multiple operations are run on a single table within a database, by using the same publishable document. Assume a scenario where multiple operations such as insertion, deletion, and updates are run on a single table named PERSON.

Creating and testing polling notifications involves the following steps:

  1. Create a database account. For more information about creating Database accounts, see Creating accounts.
  2. Create a polling notification.
  3. Create a flow service to run when the notification is received.
  4. Verify that the flow service runs when the notification is received.

Procedure

  1. Go to Projects and select your project.
  2. Go to Events > Polling notifications.
    The list of existing polling notifications are displayed.
  3. Click Add notification.
    The Add Polling notification page is displayed.
    Note:
    • The Add Notification option is displayed if the messaging service is enabled. Contact IBM® support to enable cloud messaging.
    • Ensure that the database user has privileges to create the table, trigger, and sequence for creating polling notifications.
  4. Select Database from the Connector type drop-down menu.
  5. Click Next.
    The Add polling notification | Database wizard is displayed.
  6. Configure the database account details on the Account page.
  7. Click Next.
    The Action page is displayed.
  8. Select the Ordered Notification action.
  9. Click Next.
    The Tables page is displayed.
  10. In the Tables page, do the following to add tables:
    1. Click the Add icon to add a table.
      The Add tables page is displayed.
    2. Select the table from the catalog.
      For example, the PERSON table.
    3. Click Add.
      The table is added and listed in the Tables page. In this example, the Operation type Insert, Update and Delete are selected in the PERSON table.
  11. Click Next.
    The Data fields page is displayed.
  12. In the Data fields page, do the following actions:
    1. Click the Add icon to add data fields.
      The Add data fields page is displayed.
    2. Select the data fields to be added in the table.
    3. Click Add.
    4. You can also change the Output Field Type and sort the order of a data field by clicking the corresponding Edit button.
    5. You can also select unique records for changes in a table by enabling the option Select distinct.
  13. Click Next.
    The Condition page is displayed. You can view all the conditions that have are created and also add conditions for update and delete operations on the page. In this example, no conditions are specified.
  14. Click Next.
    The Settings page is displayed.
  15. In the Settings page, do the following actions:
    1. Configure the fields in the Execution parameters settings page.
    2. Click Publish Document to view the JMS provider details. You cannot modify any values. In this example, the operations that are run on the PERSON table are retrieved and sent as a document to the destination (queue).
    3. Click Schedule to set the polling interval.
      For example, 60 seconds.
    4. Click Subscriber to configure the subscriber settings.
      You can view subscriber details and configure the flow service to start.
    5. In Service invoke, click the Add icon to create a new flow service.
      For example, a flow service by the name Flow is created.
    6. Click Save.
      Whenever the document is published to the destination (queue), the subscriber starts the configured flow service to process the next set of defined actions.
  16. Click Next.
    The Summary page is displayed.
  17. Review the settings. If you want to modify, then click the Previous button to go to the corresponding page and update the settings.
  18. Click Done.
    The Events>Polling notification page displays listing the newly created notification. By default, it is disabled.
  19. Move the slider on the toggle button in the State column to the right to enable the notification.

    In this example, the notification polls the database server at the configured interval of 60 secs and retrieves the details of Insert, Update and Delete on the same table PERSON. The details are retrieved in a document format and published to the destination (queue), the subscriber starts the flow service to process the next set of defined actions.

Creating flow services

About this task

The flow service converts the document to a JSON format and logs the details.

Procedure

  1. Go to Integrations > Flow services.
  2. Select the Flow flow service to edit.
    The Flow service editor page is displayed.
  3. On the flow service step, type documentToJSONString to convert the incoming document to a JSON string.
  4. Click View/Edit Pipeline to map the input and output fields to the service.
    The Pipeline panel is displayed.
  5. Map the pipeline input JMSMessage > body > data to the input document field in documentToJSONString.
  6. On the flow service step, type logCustomMessage to log the message.
  7. Click View/Edit Pipeline to map the input and output fields to the service.
    The Pipeline panel is displayed.
  8. Map the pipeline input jsonString to the input message field in logCustomMessage.
  9. Click Save to save the service.

Verifying flow services

About this task

Explore the following steps to check if the flow service runs when a notification is received.

Procedure

  1. Go to Monitor > Execution results > Flow service executions.
  2. Filter the results for the project that is used to create flow service.
  3. Use any database client to do the insert, delete, and update operation. This example a Delete operation is done, then an Update and an Insert on the same table, PERSON.
  4. Click the Refresh icon in the Monitor > Execution results > Flow service executions page.
    You can notice that the status is Success, which means that the flow service has run without any errors.
  5. Click the flow service to view the log details.
    In this example, you can see that the notifications are received in the order of operations ran. The polling notification is first received for the person details that was deleted, then the updated records, and lastly by the newly inserted person record by using the database client.