Listeners

Learn about various listeners supported in IBM webMethods Integration.

About Listeners

In IBM webMethods Integration, listeners are components that allow you to receive data from external sources, such as HTTP requests, emails, or message queues, and then invoke integration workflows based on that incoming data. For example, alert the sales representative to the return and send a confirmation email to the customer.

Listeners play a key role in building event-driven integrations that respond to data events, making it easier to automate business processes and workflows based on external inputs. The choice of listener depends on the specific requirements of your integration project and the data sources you need to connect to.

Note
By default, listeners are enabled for the Salesforce connector. To enable listeners for SAP® ERP, contact IBM support.

Salesforce Listeners

Creating Salesforce Listeners

To create a listener for a project, you need to have an admin, developer, or a custom role that includes write and execute permissions for that project. Without these required permissions, you would not be able to create listeners. For more information about role and permissions, see Roles.

  1. Go to the project in which you want to create a listener.

  2. Click Events > Listeners.

  3. Click New Listener. The Add Listener screen appears.

  4. Enter the following details in the Add Listener screen:

    • Type of listener: Select the name of the connector from the drop-down list for which you want to create a listener.

    • Select version: Select the connector version for which you want to create a listener.

  5. Enter the following details in the Add Listener configuration screen:

    • Name: Provide a display name for the listener. It can contain alphanumeric characters, underscores (_) and hyphens (-).

    • Description: Provide a description for the listener.

    • Streaming API endpoint URL: Specify the endpoint of the streaming provider. For configuring a Salesforce streaming endpoint, specify the URL in the following format: https:///cometd/, for example, https://ap5.salesforce.com/cometd/44.0.

    • Select replay option: The IBM webMethods Integration listener for Salesforce can subscribe and listen to Salesforce events. This allows the IBM webMethods Integration listener to establish a persistent connection with Salesforce. This connection remains open while transmitting the events until either side closes the connection. Through this established connection, events are streamed to the listener. If the connection is lost due to a network failure or any other reason, you can retrieve the standard-volume events that are within the 24-hour retention window in Salesforce. You can retrieve Salesforce events only if you are using Salesforce v37.0 or later versions.

      Each Salesforce event is assigned a unique opaque ID for each event. This ID is contained in the replayId field of the event object. The replayId field value, which is populated by Salesforce when the event is delivered to subscribers, refers to the position of the event in the event stream. For consecutive events, the replayId values may not be sequential. For example, an event with ID 110 may follow an event with ID 101.

      To replay events, Salesforce provides a way to configure the replayId while subscribing to a particular channel. You can replay the events by specifying the replay option, and use it during resubscription to retrieve events that are within the retention window.

      • Last Received: Receive all events that occurred after the most recently saved replay ID. The IBM webMethods Integration server by default saves the replay ID of your most recently received event. When you select this option, you will receive all events that occured after the most recently saved replay ID each time the listener re-connects.

      • New: Receive new events that are broadcast after the client subscribes and replay only the new events from the time the listener is enabled.

      • All: Receive all events including past events that are within the retention window and the new events. Due to the possibility of exceeding daily streaming consumption limits, IBM does not recommend using this option.

    • Select Account: Select an account to connect to the application. The streaming functionality will leverage the existing authentication, timeouts, truststore, keystore, and host name verification configurations from the referenced account selected in the Select Account drop-down list field.

    • Select subscription: Select a channel from the list of available subscription channels you want the listener to connect.

      Currently, we are supporting the following subscription events:

      • Salesforce Push Topic Event: Select this subscription event if you want to receive notifications for changes to Salesforce data that match a SOQL query you define. Learn more about Salesforce Push Topic events.

      • Salesforce Platform Event: Select this subscription event if you want to receive notifications about event messages published by publishers in real time. Learn more about Salesforce Platform Events.

      • Salesforce Change Data Capture Event: Select this subscription event if you want to receive notifications about changes pertaining to CRUD operations on Salesforce records. Learn more about Salesforce Change Data Capture Events.

      • Salesforce Generic Event: Select this subscription event if you want to receive notifications about events that are external to Salesforce. Learn more about Salesforce Generic Events.

  6. Click Next. You will be redirected to the Parameters and Headers screen.

  7. Review and configure the Parameters.

    • Review the pre-configured parameters such as name and description, the data type used to represent the kind of information the parameter can hold, and the parameterization type for the subscription request, for the selected subscription.

    • Provide a value for the Default value parameter.

      The supported default value formats for each Salesforce subscription event is listed in the following table:

      Salesforce Event Supported Default Value Format(s)
      Push Topic Event PushTopic name
      Platform Event API name
      Change Data Capture Event The following formats are supported:
      • ChangeEvent name
      • ObjectNameChangeEvent
      • CustomObjectName_ChangeEvent
      Generic Event GenericStreamingChannel name

  8. Click Add Header to add necessary headers and provide the following details:

    • Header name: Provide a valid header name.

    • Header value: Provide a default value for the header.

    • Status: Toggle on the status switch to Active to include the header as a part of the subscription request.

    • Actions: Click Delete to delete the header.


  9. Click Next and specify the following details in the Event screen:

    • Select Flow service name: Select the Flow service you want to run when the subscribed event occurs.

    • Select a user to run Flow service: Select a project user you want to use to run the selected Flow service. If the selected user does not have necessary permissions to run the specified Flow service, the Flow service execution will not complete when the subscribed event occurs.

    • Select ErrorCallBackFlowService name: Select any existing Flow service that you want to invoke when an error occurs (that cannot be automatically recovered by the listener and requires manual intervention).
      Flow services that are created with Error Callback Service Spec specification are only listed in the list.
      For more information, see this tutorial.


    Note
    • You can also create a new Flow service by clicking the Add button and providing the name.
    • By default, the Error Callback Service Spec specification is selected for the Flow services created from this page. In case, while configuring the Flow service, if you have cleared the Error Callback Service Spec option, then the Flow service is not listed in the Select ErrorCallBackFlowService name field.
  10. Click Save. The Summary tab appears.

  11. Review the listener summary.

    Note
    You can click the Flow service name to view and configure the details about the Flow service. From this method, the Error Callback Service Spec option is selected and the Specification reference field is in disabled state.

  12. Click Save. The listener is created and is in disabled state. To enable the listener, follow the instructions mentioned in Enabling Listeners.

    Note
    • Listeners created in one tenant cannot be published to another tenant.
    • The Salesforce listener receives events in the same order in which Salesforce sends them. As the Salesforce listener processes the messages asynchronously, there is no guarantee of the order of event processing.

Salesforce Listener Error Management

Listeners may encounter errors while listening to events due to reasons such as incorrect account configurations, exceeding transaction limits, or errors on the Salesforce system. When an error occurs, listeners are suspended abruptly. Following are some disadvantages of not using error management:

For Salesforce listeners you can manage erros by configuring an Error Callback Service Spec specification flow service that defines the actions that the listener must perform when a non-recoverable error occurs and the listener is suspended. Few examples are submitting a ticket to the Ticketing System or sending an SMS to the operations team. These alerts allow you to be aware of issues and rectify them as soon as possible with very minimal loss of information.

You can configure the flow service using the Select ErrorCallBackFlowService name option in the Add listener wizard. The behavior of the listener is as follows when you configure the error management option:

  1. The listener is enabled and listening to events from Salesforce. When an error occurs:

  2. Listener retries the action up to 5 times by default. If the listener:

    • Succeeds: The listener continues to listen to the events.

    • Fails: The configured callback Flow service is invoked, and the runtime status of the listener is changed to suspended state. The error information is sent to the callbackService and the details can be viewed in the Status column of the Listeners page.

    For example, you can configure the callback Flow service to show the log messages for the events that have been retried and failed. A sample message is as follows:

  3. Enable the suspended listeners after rectifying the errors manually. Or, the listener is automatically enabled after a package reload.

    Note
    • For some errors, enabling the listener alone does not work. The listener and the underlying account must be disabled followed by re-enablement of the listener with re-enablement of the underlying account too. For more information on errors, see Handling Errors.
    • For non-recoverable errors, the listener is in a suspended state after a package reload. For example, if an organization limit exceeds on number of events.

The events occurred during the listener downtime are based on the Select replay option provided during listener configuration. By default, Select replay option is set to Last Received. For more information on available replay options, see step 3 in the Creating Listeners section.

The execution details for the callback Flow services configured for listeners can be viewed from the Monitor page and are listed under the Streaming source.

Creating a Error Callback Service Spec Flow service

You can create a Error Callback Service Spec Flow service in one of the following ways:

Add listener wizard

In this method, you can create a Error Callback Service Spec Flow service directly from the Events tab in the Add listener wizard. The Error Callback Service Spec specification is automatically selected for the Flow services created using this method.

  1. Go to the Events tab in the Add listener wizard.

  2. Click the + button adjacent to the Select ErrorCallbackFlowService field. The Create CallBackErrorFlowService dialog box appears.

  3. Enter the Flow service name.

  4. Click Save. The callback Flow service is created and saved under the Flow services tab in the Integrations page. By default, the Error Callback Service Spec specification is selected for the Flow services. You must define the Flow service steps as per your requirements before enabling the listener.

Integrations page

In this method, you must manually select the Error Callback Service Spec from the Choose Specification field in the Define input and output fields page.

  1. Go to FlowServcies.

  2. Create a Flow service and define the Flow service steps.

  3. Select Error Callback Service Spec from the Choose Specification field in the Define input and output fields page.

  4. Define the Flow service steps.

  5. Save the Flow service. The callback Flow service is created and saved under the Flowservices tab in the Integrations page. The Flow services created in this manner are listed under the Select ErrorCallbackFlowService field in the Events tab of the Add listener wizard.

Handling Errors

When a recoverable or non-recoverable error occurs, webMethods Integration Server moves the listener to the Suspended state. Users can check the error details of a listener by either hovering over or clicking the Suspended option in the Status column.

While recoverable errors are handled automatically by the error handler, non-recoverable errors require user intervention to bring the listener back to active status. When you hover over or click the Suspended option in the Status column, specific details about the error are displayed on the screen. You can identify the cause of the error and take necessary actions to resolve it.

Note
During scheduled backend downtime or maintenance, it is recommended that users follow the instructions provided by the backend.

The following table lists the most common error codes that users may encounter, explanation of the cause, and potential resolutions.

Error code Error message Explanation Action
400 API version in the URI is mandatory. URI format: '/cometd/55.0' The API version is missing in the URI Specify the API version at the end of the URI. For example, '/cometd/55.0'. See Creating Salesforce Listeners for more information.
400 Unsupported API version. Only API versions '23.0' and above are supported. URI format: '/cometd/55.0' The specified API version is not supported. Specify a valid API version. Supported API versions: ‘23.0’ and above. See Creating Salesforce Listeners for more information.
400 The channel you requested to subscribe to does not exist {channel_name} The streaming channel requested to subscribe to does not exist.Ensure that you have created a channel before subscribing.
400 Channel name not specified The channel name is not specified. Specify a valid channel name to subscribe to.
400 Channel subscriptions must start with a leading '/' The specified channel name format is invalid. Specify a valid channel name. Channel names must start with a leading slash (/).
400 Query fields {query_fields} do not exist on the topic entity The supplied query fields do not exist on the Salesforce object specified in the PushTopic. Specify valid query fields on the Salesforce object in the PushTopic.
400 The replayId {replay_id} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events. The specified replay ID is invalid. Specify a valid replay ID. Specify -2 to replay all events or -1 to replay only new events.
401 Authentication invalid The specified authentication token or session ID is invalid. Perform the following steps to resolve this issue:

  1. Disable the suspended listener.
  2. Disable the associated connection and then re-enable it.
  3. Go back to the Listeners screen and enable the disabled listener.
401 Request requires authentication The authentication token or session ID was not provided in the request header. Provide a valid authentication token or session ID in the request header.
403 Cannot create channel {channel_name} The subscription channel cannot be created, which can be due to insufficient permissions. Ensure that the required access permissions are provided.
403 Subscriber does not have access to the entity in this topic The subscriber does not have access to the Salesforce object in the PushTopic. Ensure that the subscriber has access to the Salesforce object in the PushTopic.
403 Subscriber does not have access to all fields referenced in the where clause of the PushTopic. The subscriber does not have access to all fields referenced in the WHERE clause of the PushTopic. Ensure that the subscriber has access to all fields referenced in the WHERE clause of the PushTopic.
403 Handshake denied The handshake request was denied. Perform the following steps to resolve this issue:

  1. Disable the suspended listener.
  2. Disable the associated connection and then re-enable it.
  3. Go back to the Listeners screen and enable the disabled listener.
403 Client has not completed handshake The client has not completed a handshake. Perform the following steps to resolve this issue:

  1. Disable the suspended listener.
  2. Disable the associated connection and then re-enable it.
  3. Go back to the Listeners screen and enable the disabled listener.
403 Organization concurrent user limit exceeded The maximum number of concurrent clients across all channels has been exceeded.
403 Organization total events daily limit exceeded The maximum number of delivered event notifications within a 24-hour period to all CometD clients has been exceeded. Try again after 24 hours.
403 Restricted channel The user does not have the required permissions to subscribe to the streaming channel. Ensure that you have the required permissions to subscribe to the streaming channel.
403 User not enabled for streaming The user does not have the read permission on the PushTopic. Ensure that you have the read permission on the PushTopic.
403 User not allowed to subscribe CDC without View All Data permissions The user must have the View All Data permission to subscribe to Change Data Capture. Ensure that you have the View All Data permission before subscribing to Change Data Capture.
403 Unknown client The server deleted the client CometD session due to a timeout, which can be caused by a network failure. This error is recoverable and the error handler will automatically correct the error.

After some time, on the Listeners screen, click the Refresh icon to see the updated status of the listener.
403 Subscription limit exceeded for this topic The maximum number of concurrent clients per topic for PushTopic and generic events has been exceeded.
503 Server is too busy. Please try your request again later. The server cannot process the request because it is too busy. This error is recoverable and the error handler will automatically correct the error.

After some time, on the Listeners screen, click the Refresh icon to see the updated status of the listener.

What does “403: denied_by_security_policy: create_denied” mean and how can it be resolved?

The error “403: denied_by_security_policy: create_denied” indicates that the user you are connecting with does not have read or create permissions for the platform event you are trying to subscribe to. This error occurs when the security policies or access settings within Salesforce restrict the creation of platform events for that user. As a result, the subscription attempt fails because it is unable to create the event on behalf of the connecting user.

To view or modify permissions associated with the user, perform the following steps:

  1. Log in to your Salesforce account and navigate to the Setup link in the top-right corner of the home page.

  2. In the Setup page, search for “Users” in the quick find search bar or select Users under the Manage Users section on the left sidebar.

    A list of users appears on the screen.

  3. Click on the name of the specific user for whom you want to check the permissions.

  4. On the User detail page, find the Profile field and click on the profile name.

  5. On the Profile detail page, scroll down to find the Platform Event Permissions section and review the permissions assigned to that profile for the platform event. To update the permission set, click on the Edit button, select the checkboxes next to the required permissions, and click Save.

SAP® ERP Listeners

You can create RFCs on the SAP system that invoke services on Integration. This allows SAP users to access the information that is available using SAP® ERP. Before you can create an RFC that invokes a service, you must configure the SAP system to have an RFC destination for an RFC listener running at SAP® ERP. This enables the SAP system to send RFCs. You must also configure the SAP® ERP to have an RFC listener that listens for RFCs from the SAP system.

Creating SAP® ERP Listener

Complete the following fields to create a new SAP® ERP listener:

Field Description
Add Listener
Type of listener Type of listener. For example SAP® ERP.
Select a version Version of the listener type selected.
Listener
Listener name Name of the new listener.
Program ID Program ID specified when creating the corresponding RFC destination in the SAP system. This field is case sensitive.
Retry limit Number of times that the system must attempt to start the listener if the initial attempt fails. When the value is set to 0, the system makes a single attempt.
Retry backoff timeout Time in seconds that the system must wait between each attempt to start the listener. This field is irrelevant if the value of Retry limit is 0.
Connection mode setting selection
Gateway host Gateway Host for accessing the SAP system. This must be exactly the same parameter as you chose for the corresponding RFC destination in the SAP system.
Gateway service Gateway Service corresponding to the SAP system number.
Repository server Outbound connection alias used as a repository for function interfaces and structure definitions of inbound calls. This way it is possible to use RFCs even if they are not defined in the calling system.
Logging
RFC trace Enable RFC tracing. Default is disabled.
Log transaction status Enable logging of transaction status. Default is enabled.
Store message body Enable the message body of the incoming document to be stored, even when a transaction is created (or maintained), and can be monitored later in the transaction list.
Note
Only one RFC listener can be enabled for a Program ID across projects.

SAP® ERP Listener Notification

A listener notification works in conjunction with a listener to filter and process the RFC requests and IDocs in SAP® ERP. SAP® ERP uses the following listener notifications to process requests:

You can change the priority of the listener notification execution by dragging and changing the position of the notification in the list.

Note
In this context, synchronous or asynchronous refers to the processing on Integration and not on how the message was processed on the SAP system. However, in case of ALE listener notification, a TID is always assigned to the message. In the case of an RFC listener notification, a TID is present in the pipeline only for transactional RFC calls from the SAP system.

Create New ALE Listener Notification(synchronous)

Complete the following fields to create a new listener notification for ALE Listener Notification(synchronous):

Field Description
Account
Name Listener Notification name.
Description Listener Notification description.
Action
Name Select the listener notification type as
  • ALE Listener Notification(synchronous).
  • IDoc
    IDoc Type Identifies the type of IDoc expected by the listener notification.
    Cim Type IDoc type extension (CIM type/customer extension type).
    SAP system release IDoc release.
    Old IDoc type 2 IDoc version
  • Checked for old version 2 IDocs.
  • Unchecked for a new version 3 IDoc.
  • Request Field Selection
    Name Name of the input parameter.
    Type Java data type of the input parameter.
    Execution Mode
    Service invoke Name of the Flow service to invoke when the notification is received.
    Forward confirm event Enable or disable the SAP ERP to forward the Confirm TID event triggered by the tRFC protocol to the same destination where the document is forwarded.
    Monitor iDocs Enable or disable the SAP ERP to link the IDoc packet’s TID with the DOCNUMs of the IDocs in that packet.

    Create New RFC Listener Notification (Synchronous)

    Complete the following fields to create a new listener for RFC Listener Notification (Synchronous) notification:

    Field Description
    Account
    Name Listener Notification name.
    Description Listener Notification description.
    Action
    Name Select the listener notification type as
  • RFC Listener Notification (Synchronous).
  • Function
    Function pattern Type all or part of the name of the function module for which you want to create a listener notification (SAP® ERP). Use pattern-matching characters if you are unsure of the complete name and want SAP® ERP to search for several RFCs with similar names. For example, enter RFC_FUNCTION_* in the field.
    Group pattern Type all or part of the name of the group for which you want to create a listener notification (SAP® ERP). Use pattern-matching characters if you are unsure of the complete name and want SAP® ERP to search for several RFCs with similar names.
    Reset Reset the search.
    Apply Apply the pattern or exact search.
    Function name Lists the function names matching the pattern.
    Group name Group name to which the matching functions belong.
    Description Description of the matching functions.
    Request Field Selection
    Name Name of the input parameter.
    Type Java data type of the input parameter.
    Reply Field Selection
    Name Name of the output parameter.
    Type Java data type of the output parameter.
    Execution Mode
    Service invoke Select the Flow service to invoke when the notification is received.
    Note
    • The documents, Notification\_NameRequestDocument for Request document name and Notification\_NameReplyDocument for Reply document name are created when a listener notification is created. You can view the documents by clicking the icon in the Flow service.
    • You must select routing listener for routing listener notifications and RFC listener for RFC listener notifications.
    • While publishing a project:
      • Assets such as listeners are not published. The listeners are selected from the pre-existing listeners or new listeners are created during deployment.
      • Assets such as listeners with no associated listener notifications are not displayed for publishing.

    Listener Status

    You can view the runtime status of a listener in the Status column on the Events > Listeners section.

    1. Go to the project in which you want to create a listener.

    2. Click Events > Listeners. All configured listeners are listed.

      Note
      Click the corresponding Refresh button in the Actions column to view the current status of a listener. For more information about refresh, see Refreshing Listener Status.

      The runtime status of the listeners is displayed in the Status column. The status of a configured connector listener can be one of the following:

      • Active: Listener is enabled and active.

      • Disabled: Listener is inactive.

      • Pending Enabled: Enabling listener is in progress.

      • Pending Disabled: Disabling listener is in progress.

      • Suspended: Listener is suspended when an error occurs during enabling or disabling of the listener.

    3. Hover over the Suspended status in the Status column to check the runtime state of a suspended listener.

    4. Click on the Suspended status in the Status column to get a detailed explanation of the error status.

      Note

      For Salesforce listener, the suspension could be for one of the following reasons:

      • The configured connector listener is currently recovering from a subscription error. These errors are typically recoverable errors and might get recovered automatically without any user intervention. For example, errors such as connection throttling, busy server, or intermittent network failure,recover automatically after a certain time.
      • The configured connector listener has failed to recover due to a subscription error. These errors are fatal errors and require user intervention to recover. For example, errors such as invalid authentication, invalid connection type, handshake denied or time limit exceeded, are resolved only if users take the right actions.
        For more information about errors, see Handling Errors.

    Manage Listeners

    You can view, modify, and delete listeners using the options available in the Events > Listeners section.

    Enabling Listeners

    All newly created listeners are disabled by default.

    You can enable a disabled listener by using the Enabled/Disabled toggle button in the State column on the Events > Listeners section. After a listener is enabled, connection with the configured streaming APIs is established. Events are received and processed based on the configured flow.

    Note
    • At times, enabling or disabling a listener might take some time.

    • If the Select replay option is configured as Last Received, IBM webMethods Integration saves the replay ID of your most recently received event.

    • Listeners configured with the Select replay option as New and enabled with a specific replay id might miss some of the replay events. This is in accordance with the current feature design.

    To enable a listener, do the following:

    1. Go to the project in which you want to create a listener.

    2. Click Events > Listeners. All created listeners appear.

    3. Move the slider on the Enabled/Disabled toggle button in the State column to right. The Configure listener dialog box appears.

    4. Enter the replay ID if you want the listener to receive events from a specific replay ID. For example, if you have events A, B, C, and D with replay IDs A1, B1, C1, D1 respectively, and you want to replay all events that occurred after event B, then enter the event B’s replay ID, that is, B1 in the Specify replay Id field.

      • If you do not enter any value, then the value configured in the Select replay option field during listener creation is considered.

      • For new events, enter -1.

      • For all events, enter -2.

    5. Click Enable. The listener is enabled and receives the events based on the replay ID provided.

      Note
      Salesforce has different allocations for PushTopic, Generic, Change Data Capture, and Platform events based on your license. Ensure that you have carefully reviewed the allocations to understand your subscription and consumption limit for your configured solution.

    Editing Listeners

    You cannot edit a listener while it is enabled. Additionally, the channel you have subscribed to cannot be modified after you have created a listener.

    Click the Edit button available in the Actions column to update the listener changes.

    Refreshing Listener Status

    The user interface is not dynamically updated based on the listener status.

    For example, if a configured listener encounters an error, you may not receive events from Salesforce or the linked integration may not run as expected. During such scenarios, you must manually refresh the listener by clicking the Refresh icon to ensure that the latest status of the listener is reflected in the user interface. To know the current status of a listener, manually refresh the listener by clicking the Refresh icon in the Actions column.

    Deleting Listeners

    You can delete an existing listener by clicking the Delete button available in the Actions column

    However, an enabled listener cannot be deleted.

    How to set up a Salesforce listener?

    Let us now understand how to set up a Salesforce listener and run a flow service associated with the listener with the help of an example.

    We’ll set up a listener for a Salesforce platform event, and invoke a flow service whenever the platform event updates occur.

    1. Login to IBM webMethods Integration tenant, select a project, and create the Flow service you want to invoke when the subscribed listener event occurs.

    2. In the same project, go to Events > Listeners.

    3. Click New Listener. The Add Listener screen appears.

    4. In the Add Listener screen, select the version for which you want to set up a listener.

      As soon as you select a version, you are redirected to the Configure the Listener screen.

    5. Provide the following details to configure the listener:

      • Name: Provide a display name for the listener. It can contain alphanumeric characters, underscores (_) and hyphens (-).
      • Description (optional): Provide a description for the listener.
      • Streaming API endpoint URL: Specify the Salesforce streaming API endpoint URL associated with the Salesforce account for which you want to set up a listener. For example, https://ap5.salesforce.com/cometd/48.0
      • Select Account: Select an existing Salesforce CRM account or create a new one.
      • Select replay option:
        • Select New if you want to receive new events that are broadcast after the client subscribes and replay only the new events from the time the listener is enabled.
        • Select All if you want to receive all events including past events that are within the retention window including new events and replay all the events for the last 24 hours.
        • Select Last Received to receive all events that occurred after the most recently saved replay ID. IBM webMethods Integration by default saves the replay ID of your most recently received event. When you select this option, you will receive all events that occured after the most recently saved replay ID each time the listener re-connects.
      • Select subscription: As you want to listen to a Salesforce platform event, select Salesforce Platform Event from the drop-down list.
    6. Provide a default value for the subscribed Salesforce event. As you have subscribed to a Salesforce platform event, the default value is the API Name associated with the platform event you want to listen to. (Refer to the Salesforce event and their supported default value format table available under step 5 in the previous section.)

      You can retrieve the API Name associated with the platform event from your Salesforce account.



    7. Click Next.
    8. Select the Flow service you want to invoke and the user through which you want to run the Flow service.

    9. Click Next.
    10. Review the listener configuration and then click Save.

    11. Enable the listener.

      With this, the listener starts listening for updates on the subscribed Salesforce platform event.

    12. Now, to test if the listener is working as expected, perform the trigger event in your Salesforce account. For the purpose of this example, let’s create a custom action that automatically updates a specific field of the Salesforce platform event, thereby triggering the listener. You can alternatively use any other method of your choice to perform the trigger event.

    13. Create a new Flow service and select the Salesforce CRM connector with the version for which you have created the listener.

    14. In the Type to choose action drop-down menu, select Add Custom Operation.

    15. Select the authentication type, select/create the account you want to use to execute the custom action, and provide a name for the custom action.

    16. Click Next.
    17. In the Operation screen that appears, select the create operation and then click Next.

    18. In the Input Business Object screen, select the Salesforce platform event name for which you have created the listener and then click Next.

    19. In the Select the Data Fields screen, select the field(s) on which you want to perform the update operation. The list of fields displayed on this screen will vary based on the selected Salesforce platform event.

    20. Click Next.
    21. Review the entered custom action details and then click Done.

    22. Click the Edit Mapping icon.

    23. Click the + icon beside the custom action input block.

    24. Double-click the field names to configure the input values. When you run this custom action, these values are updated to the corresponding Salesforce platform event fields.

    25. Click Save.

    26. Provide a display name for the Flow service and click Save.

      With this, you have created a Flow service which when run, automatically updates the specified field of the Salesforce platform event and triggers the listener.

    27. Run the Flow service.

      On successful Flow service execution, the output similar to the one shown in the following image is displayed on the right-hand side of the screen.

      This updates the corresponding field value(s) in the specified Salesforce platform event.

      As soon as the Salesforce platform event is updated, IBM webMethods Integration runs the Flow service associated with it using the project user selected at the time of listener configuration.

    28. Go to Monitor > Execution results > Flow service execution to view the execution logs of the invoked Flow service.

    How to configure an Error Callback Service Spec flow service for Salesforce listener?

    Scenario

    Let us create a flow service that sends an email for the listener failure events where the ErrorCallBackFlowService has been invoked. The following event logs are captured by the listener from the Salesforce application and the logs are in the document Reference format.

    Solution

    1. Go to Flow Editor and provide a name for the flow service, say, ListenerCallbackService.

    2. In the flow step, select the function JSON DocumentToJSONString to convert errorDetails that are in document format to jsonString format.

    3. In the next flow step, select the function JSON DocumentToJSONString to convert results that are in document format to jsonString format.

      Both the logs are converted to JSON string format.

    4. In the next flow step, select the function Concat to concatenate the logs converted to jsonString format in steps 2 and 3.

    5. In the next flow step, select Flow LogCustomMessage to log the concatenated message.

    6. In the next flow step, select the Send Email action from the Simple Mail Transfer Protocol (SMTP) connector to send the logged message in step 5 as an email.

      Till now, the flow service has the following steps:

    7. Save and run the flow service. You will receive an email listing the failure details.

      Also, the logged message can be viewed under Flow service executions on the Monitor page.

    How to create and invoke RFC Listeners Notification?

    Let’s understand how to use the SAP® ERP RFC Listener Notification with the help of an example.

    Let’s say you have a project Test_SAP_ERP. You want to create a SAP® ERP Listener.

    To create a SAP® ERP Listener follow the steps given below:

    1. Click New listener, select SAP® ERP for Type of listener and SAP® ERP_v1.0 for Select version from the dropdown list.

      This will redirect you to the Add listener configuration screen.

    2. Provide the following details:

      • Listener name - Provide a unique name for the listener.
      • Program Id - Provide the program id for the listener.
      • Retry limit - Enter the number of times the listener will try to connect to the server.
      • Retry backoff timeout- Provide the delay between each subsequent connection try.

      Click Next.

    3. Select Standard (Default) action.

      Click Next.

    4. Provide the following details in the Connection mode:

      • Gateway host - Provide the host address.
      • Gateway service - Provide the service number.
      • Repository server - Provide the repository server.

      Click Next.

    5. Enable/Disable the logging details.

      • RFC trace - Enable the RFC trace.
      • Log transaction status - Store the transaction status.
      • Store message body - Store the message body.

      Click Next.

    6. Verify the connection details.

      Click Save and Next.

    7. Click Add listener notification.

      This will redirect you to the Add Listener Notifications screen.

    8. Provide the following details:

      • Name - Provide a unique name for the notification.
      • Description - Provide a description.

      Click Next.

    9. Select RFC Listener Notification (synchronous) action.

      Click Next.

    10. Search and select the RFC function to invoke:

      a. You can perform search with different combinations as shown:

      • Type the exact function name in the Function pattern field. For example: Z_RFC_ADD.
      • Type the exact group name to which the function belongs in the Group pattern field. For example: Z000.
      • Type the function pattern in the Function pattern field. For example: Z_RFC*.
      • Type the group pattern to which the function belongs in the Group pattern field. For example: *.

      Click Apply.

      b. Select the function from the list of function names available on the screen. In the example, select the Z_RFC_ADD function.

      Click Next.

    11. In the Request Field Selection screen, select the input fields to add.

      In the example, select IP_VALUE1 and IP_VALUE2 input fields.

      Click Next.

    12. In the Reply Field Selection screen, select the output fields to add.

      In the example, select EP_RESULT output field.

      Click Next.

    13. Select the service to be invoked from the dropdown list.

      Click Next.

    14. Verify the details.

    15. Click Done. You will see the configured notification.

    16. Invoke the Listener notification using the SAP GUI.

      a. Provide the following details in Test Function Module screen:

      • RFC target sys: Provide the target system id. This is same as Program Id in Listeners.
      • Import parameters: Provide the input values.

      b. Click to execute.

    How to use the SAP® ERP for RFC invocation?

    Let’s understand how to use the SAP® ERP for RFC invocation with the help of an example.

    Let’s say you have a Flow service SAP_ERP_Test_FS inside Test_SAP_ERP project. The Flow service SAP_ERP_Test_FS used in the example is a simple Flow service that uses the RFC invocation action from SAP® ERP You want to invoke this Flow service.

    To invoke and run SAP_ERP_Test_FS(Flow service), you must create an account to connect to SAP® ERP.

    1. Start creating the Flow service. Select SAP® ERP from the dropdown list.

    2. Select Add Custom Operation in the dropdown list next to SAP® ERP.

      This will redirect you to the Action configuration screen.

    3. Provide the following details:

      • Name - Provide a name for the action.
      • Description - Provide a description.
      • Connect to account SAP® ERP - You can select an existing account (if any) from the Select Account dropdown list or select ’+’ to add a new SAP® ERP account.

      Click Next.

    4. Select RFC Invocation action.

      Click Next.

    5. Search and select the RFC function to invoke:

      a. You can perform search with different combinations as shown:

      • Type the exact function name in the Function pattern field. For example: Z_RFC_ADD.
      • Type the exact group name to which the function belongs in the Group pattern field. For example: Z000.
      • Type the function pattern in the Function pattern field. For example: Z_RFC*.
      • Type the group pattern to which the function belongs in the Group pattern field. For example: *.

        Click Apply.

        In the example, search for Z_RFC*.

      b. Select the function from the list of function names available on the screen.

      In the example, select the Z_RFC_ADD function.

      Click Next.

    6. In the Request Field Selection screen, select the input fields to add.

      In the example, select IP_VALUE1 and IP_VALUE2 input fields.

      Click Next.

    7. In the Reply Field Selection screen, select the output fields to add.

      In the example, select EP_RESULT output field.

      Click Next.

    8. Verify the details.

      Click Add.

    9. Click Done. You will be redirected to the Flow services screen.

    10. Run the Flow service.

      a. Click the icon and add the values for the input parameters.

      b. Click the icon. The resulting value is displayed.