Creating insert polling notifications

Create an Insert database polling notification to monitor a specified database table for new records. When a new row is inserted, the notification automatically starts an integration, capturing the inserted data and enabling real-time processing or integration with other systems. These alerts help automate data-driven tasks such as syncing new entries, sending alerts, or updating downstream applications.

Before you begin

  • Make sure that the messaging capability is enabled for your webMethods Integration tenant.
  • 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.
  • Make sure that the database user has privileges to create table, trigger, and sequence.

About this task

In this example, a polling notification is created to log a message when a new customer is added to the CUSTOMER table. SamplePollingNotification project is used for this tutorial.

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 list.
  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 Insert notification action.
  9. Click Next.
    The Tables page is displayed.
  10. Do the following to add tables:
    1. Click the Add icon to add a table.
      The Add tables page is displayed.
    2. Select the CUSTOMER table from the catalog.
    3. Click Add.
      The table is added and listed in the Tables page.
  11. Click Next.
    The Joins page is displayed. In this example, joins are not added.
  12. Click Next.
    The Data page is displayed.
  13. In the Data 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.
      You can also change the Output Field Type and Sort Order for a data field by clicking the corresponding Edit button. Here, the Output Field Type of the field DOB to the java.lang.String is changed.
  14. Click Next.
    The Condition page is displayed. You can see all conditions that are created and also add conditions. In this example, no conditions are specified.
  15. Click Next.
    The Settings page is displayed.
  16. In the Settings page, do the following actions:
    1. In the Execution parameters page, specify the time out value.
      For example, 60 seconds.
    2. Click Publish Document to view the JMS provider details. You cannot modify any values. The newly added customer details are retrieved from the customer table and sent as a document to the destination (queue).
    3. Click Schedule to set the polling interval.
    4. Click Subscriber to configure the subscriber settings. You can view the 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 InsertCustomerFS 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.
  17. Click Next.
    The Summary page is displayed.
  18. Review the settings. If you want to modify, then click the Previous button to go to the corresponding page and update the settings.
  19. Click Done. The Events>Polling notification page displays, and lists the newly created notification. By default, it is disabled.
  20. Move the slider on the toggle button in the State column to the right to enable the notification.
    Now, this notification polls the database server at the configured interval of 60 secs and retrieves the details of the newly added customers. The details are retrieved in a document format and published to the destination (queue), the subscriber starts the InsertCustomerFS 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 InsertCustomerFS flow service to edit.
    The flow service editor appears.
  3. On the flow service step, type documentToJSONString to convert the incoming document to a JSON string.
  4. Click the 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 the flow service.
  3. Use any database client and insert a record in the table monitored.
  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 ran without any errors.
  5. Click the flow service to view the log details.
    You can see the customer details that were inserted by using the database client.