Cloud Messaging

Implement the messaging functionality by bringing the JMS-based messaging capabilities. Publish messages and subscribe to those messages with ease.

About Cloud Messaging

Messaging is one of the integration patterns used by the enterprise applications to solve integration challenges. Messaging systems allow independent applications to work together to accomplish some common tasks by means of exchanging messages without requiring direct connections. Messaging is also known as message-oriented middleware (MOM), as it allows software components that were developed independently and ran on different networks to interact with each other.

MOM uses a messaging provider to mediate messaging operations. MOM systems are composed of three basic components: clients, messages, and a MOM provider, including an API and administrative tools. The messaging provider uses different architectures to route and deliver messages such as, a centralized message server, distributed routing and delivery mechanism to each client machine, or a combination of both approaches. The basic process of message exchange is as follows:

  1. A client sends a message using an API call to a destination managed by a MOM system.

  2. The provider routes and delivers the message.

  3. The provider possesses the message until the receiving client retrieves it, so the client can continue doing other work after sending the message.

The webMethods.io Integration messaging solution allows you to implement the send/receive (publish/subscribe) or point-to-point messaging styles by bringing the JMS-based messaging capabilities . It provides the infrastructure for implementing synchronous message-based solutions that are built on the publish-and-subscribe model.

By using a message-based model and a provider, you can create a loosely coupled system. It runs reliably, without interruption, even if a component or connection fails.

Note: Messaging is not available by default for a tenant. To enable this functionality, contact Software AG Global Support.

Terminology

Messaging Workflow in webMethods.io Integration

The webMethods.io Integration messaging solution allows you to implement the send-receive (publish-subscribe) or point-to-point messaging styles by bringing the JMS-based messaging capabilities . It provides the infrastructure for implementing synchronous message-based solutions that are built on the publish-and-subscribe model. The message exchange process in webMethods.io Integration is as follows:

  1. The publisher publishes events received from the external applications to a destination (queue or topic) specified in the publisher’s Workflow or FlowService using the connectors - Messaging or JMS.

    • The Messaging connector is used to publish messages to the Internal Messaging Provider.

    • The JMS connector is used to publish messages to the External Messaging Provider.

  2. The messaging provider (internal or external) sends the messages to the registered subscribers.

  3. The subscriber evaluates the messages in accordance to the routing rules defined. If no rule satisfies the criteria, the default invocation is initiated. If default invocation is not specified, then the subscriber acknowledges the message and no invocation happens.

  4. The initiated Workflow or FlowService performs the subsequent tasks as configured in webMethods.io Integration.

The messaging provider delivers messages in the order they are received. In addition, it ensures a consumer always processes messages in the same order as they are received. The messaging provider can hold up to 10000 messages per queue or topic. All messages arriving at the destinations are dropped if the hold capacity limit is reached, until the number of messages waiting to be delivered decreases. The dropped messages cannot be recovered. Consumed messages are immediately removed from a queue or a topic, and are no longer available for consumption by any other subscriber. If there are no subscribers, based on the destination type, the message retention is as follows for internal messaging providers:

Notes:

  • Internal messaging providers have a 30-day message retention period. In the case of an external messaging provider, you can set the retention period based on your requirements.

  • Messaging is available for all projects in a tenant after it is enabled for that tenant, but you cannot refer to queues or topics created under a project from other projects.

High-level Tasks for Configuring Messaging

Task Description
Enable the messaging functionality Contact Global Support to enable the messaging functionality for your tenant in webMethods.io Integration.
Create a destination Set up a topic or queue to receive messages from publishers and store them until a subscriber consumes them.
Create a publisher FlowService or WorkFlow Create a FlowService or Workflow to publish messages to a queue or topic using the Messaging Service connector. The input data to the publisher FlowService or Workflow can be a string or a document that is received from other applications.
Create a subscriber Create a subscriber to perform the following tasks:
  • Subscribe (listen) for messages received by a queue or topic.
  • Define message routes.
  • Define default invocation.
Create an invocation FlowService or WorkFlow Create a FlowService or Workflow to consume messages from a queue or topic. The consumer is associated with a subscriber and runs when a queue or topic receives messages.

See the examples that follow to create and configure messaging components.

Metrics Associated with Queues and Topics

After you create a queue or a topic, the metrics available for a queue or a topic appear when you click the queue or the topic link to view the details.



Subscribers

A subscriber receives messages published by a publisher. To receive published messages, you must create a subscription to that destination. After a subscription is created, a subscriber can view only messages published to the destination. As soon as a subscription receives an incoming message, it invokes a Workflow or FlowService defined in the subscription.

Message Routing in Subscribers

The Message Routing feature enables you to define one or more routing rules for messages within a subscriber. Setting routing rules allow you to define the actions that must be taken after receiving a message without requiring manual intervention.

A routing rule consists of two parts: an expression that specifies when the rule is applicable, and an action that must be completed. These processes can perform any processing, including extraction of the message and integration with back-end systems or a notification action. For example, a routing rule may initiate a business process that sends an alert notification to an administrator whenever a customer feedback message arrives in the mailbox.

Upon receiving a message, webMethods.io Integration evaluates each routing rule. When the rule criteria match, the application initiates the business processes (invokes target) that is configured in the rule. If none of the rules satisfy the criteria, the application initiates the business process specified in Default invocation.

webMethods.io Integration evaluates the routing rules in the same order in which the rules appear in the editor. It is possible that a message could satisfy more than one routing rule. However, webMethods.io Integration runs only the Workflow or FlowService associated with the first satisfied routing rule and ignores the remaining routing rules. Therefore, the order in which you list routing rules on the editor is important.

For example, to process a purchase order, you might create services that:

  1. adds a new customer record to a database.
  2. adds a customer order.
  3. bills the customer.

The service that adds a customer order can only run successfully if the new customer record has been added to the database. Likewise, the service that bills the customer can only run successfully if the order has been added. You can ensure that the services run in the necessary order by creating a subscriber that contains one routing rule for each expected message.

Subscriber Workflow

Creating Subscribers

You can create subscribers in one of the following ways:

Creating Subscribers through Messaging

  1. Go to Messaging > Subscribers. The Subscribers page appears.

  2. Click Add Subscriber. The New Subscriber page appears.

  3. Enter the following details:

    1. Name - Name of the subscriber.

    2. Description - Short explanation about the subscriber.

    3. Account:

      1. Connector type - Type of connector you want to use. Select one of the following options:

        • Messaging for using an Internal Messaging Provider.

        • JMS for using an External Messaging Provider.

      2. Account - Account associated with the connector chosen in the previous step. If you have chosen:

        • Messaging - Use defaultaccount.

        • JMS - Use one of the listed accounts other than defaltaccount. Alternatively, you can create a new account by clicking . For more information on creating an account, see Configuring Account for JMS Connector.

    4. Destination:

      a. Destination type - Type of destination, either Queue or Topic.

      b. Select destination - Name of the destination.

    5. Default invocation:

      a. Invocation type - Type of invocation, either Workflow or FlowService.

      b. Select invocation - Name of the invocation. Alternatively, you can add a new invocation by clicking .

      Note: For subscribers created prior to version 10.11, the Invocation type and Invocation name fields are grouped and named as Default invocation. Thus, the existing Invocation section is known as Default invocation.

  4. Do the following to add routing rules:

    1. Click Add routing rule. The New routing rule page appears.

    2. Enter the following details:

      a. Name - Name for the routing rule. This name must be unique for each routing rule. It is used to identify the routing rule in other parts of the application.

      b. Filter - Expression that must be evaluated before running the invocation; can be empty for default routing rule.

      c. Invocation type - Type of the invocation (Workflow or a FlowService) that must be invoked when a message arrives.

      d. Select Invocation- Name of the invocation that must be invoked. You can create a new invocation if none of the existing ones suffice by clicking .

      e. Click Add. The newly added rule appears under Routing rules.

      f. Repeat the sub steps in this step to add more routing rules.

      Tips:

      • You can edit or delete a routing rule by clicking the Edit or Delete buttons near the rule in the Subscriber details page.

      • Reordering Routing Rules: webMethods.io Integration evaluates the routing rules in the same order in which the rules appear under Routing rules. However, you can reorder the rules as per your requirement by performing the following steps in the Subscriber details page:

        a. Select a routing rule.

        b. Move the selected rule up or down the list to the desired position.

  5. Click Save. The subscriber details appear.

    Notes:

    • You can edit or delete a subscriber by clicking the Edit or Delete buttons near the subscriber from the Subscribers page. Alternatively, you can click the Edit button from the Subscriber details page to edit a subscriber.

    • All the routing rules defined for a subscriber (either from Workflow or Subscriber) are listed in the respective Subscriber details page under the Routing rules section. If you modify any existing values or add more routing rules to a subscriber from the Subscribers page, the corresponding Workflow trigger is automatically updated with these changes. The newly added routing rules are listed under Filters for a Workflow trigger. Similarly, if you modify any values or add more filters to a Workflow trigger, then those details are automatically updated and listed in the Subscriber details page. Hence, the message evaluation might not always follows the order in which the rules are listed for a subscriber.

Creating Subscribers through Workflows

  1. Go to Integrations > Workflows. The Workflows page appears.

  2. Click Add. The Start Building your Workflow page appears.

  3. Click Create New Workflow to start creating a Workflow. The Workflow canvas appears.

  4. Click the Settings icon on the Start step . The Trigger page appears.

  5. Search and select the Messaging Service trigger.

    Note: Version: 1 Messaging Service triggers cannot be modified.

  6. Click Next. The Messaging Service page appears.

  7. Perform the following steps to add a subscriber:

    1. Click . The Add subscriber page appears.

    2. Enter the following details:

      a. Subscriber Name - Name of the subscriber.

      b. Description - Short explanation about the subscriber.

      c. Destination type- Type of destination, either Queue or Topic.

      d. Destination - Name of the destination.

    3. Click Save. The subscriber is created.

  8. Perform the following to add filters:

    1. Click Add Filters. The filter fields appear.

    2. Enter the following details:

      a. Name - Name for the routing rule. This name must be unique for each routing rule. It is used to identify the routing rule in other parts of the application.

      b. Filter Expression - Expression that must be evaluated before running the invocation; can be empty for default routing rule.

    3. Repeat the sub steps in this step to add more filters.

  9. Click Save. The Test trigger page appears.

    Note: If you want to test the trigger for a subscriber, you must first publish a message and then click the Test button to see whether the message is received.

  10. Click Skip. The Trigger output datapage appears.

  11. Click Done. The Workflow canvas appears.

  12. Drag and drop the Logger connector on to the canvas from the Search pane.

  13. Click the warning icon on the Logger. The Logger page appears.

  14. Click Next. The Logger connector fields appear.

  15. Drag and drop string to the Log Data field.

  16. Click Next. The Test this action page appears.

  17. Click Done. The Workflow canvas appears.

  18. Connect Logger to the Stop step.

  19. Provide a name and description for the Workflow.

  20. Save the Workflow. Now the Workflow is ready to receive messages and process further steps based on the filters specified.

    Notes:

    • You can edit a subscriber’s filters by clicking the Edit button of the Messaging Service trigger from a Workflow.

    • If a Workflow is associated with only one subscriber and you have deleted the trigger, then the subscriber is also deleted.

Subscriber Error Management

During message processing, a subscriber may encounter errors that can generally be categorized as follows:

A subscriber acknowledges the message when an error occurs by default. However, subscribers can be configured to retry messages depending on the type of the errors encountered. You can set a subscriber’s behavior for managing errors from the Subscriber settings dialog box.

Note: The error handling options are only applicable when FlowService is the invocation target. For example, if your subscriber specifies Workflows for some routing rules and FlowService for others, these options work if FlowService is invoked due to a routing rule. Incase of Workflows, the messages are acknowledged automatically.

Transient Errors

Transient errors occur because of a temporary situation that might be resolved quickly, for example, the inaccessibility of a resource due to network failure or an inability to connect to a database, or whenever the invoked FlowService calls the throwExceptionForRetry service causing it to fail with transient error. As the condition that caused the Subscriber to fail is temporary, it is possible for the Subscriber to invoke FlowService successfully if it waits and then re-runs. Hence, you can configure the retry mechanism.

When a Subscriber fails because of a transient error, webMethods.io Integration does the following:

  1. Verifies if the retry limit is reached.

    • Yes - Verifies if the subscriber is configured to suspend on error:

      • Yes - Suspends the subscriber temporarily and recovers the message. This indicates that the required resources are not ready to process the message and makes the message available for processing later.

      Note: Subscriber remains in suspended state until one of conditions specified in the Subscriber State section is met. After the subscriber is enabled, the messaging provider redelivers the same message, and the subscriber processes the message.

      • No - Acknowledges the message and the FlowService invocation is marked as failed. In this scenario, if you have configured the subscriber to suspend on fatal error, then the subscriber suspends

    • No - Retries to process the message at configured retry intervals.

Fatal Errors

Fatal error occurs because of an exceptional situation that cannot be resolved. As the subscriber cannot resolve the condition that caused the operation to fail, the subscriber aborts the operation with a failure exception.

When a Subscriber fails because of a fatal error, webMethods.io Integration does the following:

  1. Verifies if the subscriber is configured to suspend on error.

    • Yes - Suspends the subscriber temporarily and sends an acknowledgment.

    • No - Sends an acknowledgment for the message.

In both the scenarios, the message processing ends with an error. The subscriber is ready to process the next message.

Configuring Subscriber Error Handling Mechanisms

  1. Go to Messaging > Subscribers. The Subscribers page appears.

  2. Perform one of the following actions:

    • For New Subscribers

      1. Click Add Subscriber. The New Subscriber page appears.

    • For Existing Subscribers

      1. Click the Edit button adjacent to the subscriber you wish to update in the Subscribers list page.
        Or, Click the Edit button in the Subscriber details page. The Update Subscriber page appears.

  3. Click the Settings icon. The Subscriber settings dialog box appears.

  4. Click the Error handling tab. The error handling options appear.

  5. To configure Fatal Errors - Set the Do not suspend the subscriber option with one of the following values:

    • ON - if you want to suspend the subscriber when an error occurs.

    • OFF - if you do not want to suspend the subscriber when an error occurs. The default is OFF .

  6. To configure Transient Errors - Enter the following values under the Transient Error Handling section:

    • Max retry attempts - Number of times that a FlowService (invoked by the subscriber) must retry to process a message if it fails because of a transient error. The default value is Five. Setting it to Zero indicates that the FlowService does not retry to process the message. You can specify a value in the range from Zero to 100.

    • Retry interval - Duration that the system waits before retrying to run the FlowService again. The default value is 10 seconds . You can specify a value in the range from Four to 3600 (Four seconds to One hour).

    • On retry failure - Action to be taken after the retry count limit is reached. You can specify one of the actions:

      • Throw exception - FlowService stops processing the current message with an exception. The current message is acknowledged, and the subscriber starts processing the new messages.

      • Suspend and retry later- Recovers the message to the messaging provider and suspends the subscriber.

  7. Click OK. The subscriber performs the actions as configured whenever an error occurs.

External Messaging Providers

The External Messaging Providers are those messaging providers that are provided by an external vendor. It is hosted on an external system other than the webMethods.io Integration for you to publish or consume messages.

The functioning of external messaging provider is same as that of the internal messaging provider. The only difference is that the external messaging provider is managed by your organization and not by Software AG. Since it is external to Software AG you need to create a JMS Account to connect to the external provider.

Note: External Messaging Providers are only available for FlowServices and not Workflows.

Currently, webMethods.io Integration supports the following external messaging providers:

Note: In order to connect to Universal Messaging in webMethods Cloud Container the you must enable the Allow External Access to Messaging option:

JMS Connector Parameters

Input Parameters

Output Parameters

Configuring JMS Connector Account

  1. Go to the JMS Add account wizard in one of the following ways:

    • Workflows

      1. Create a new workflow and select the JMS connector.

      2. Click JMS connector. The JMS page appears.

      3. Click adjacent to Connect to JMS.

    • FlowServcies

      1. Create a new FlowService and select the JMS connector in the step. The fields associated with the JMS connector appears.

      2. Select Send for the Action dropdown list.

      3. Click and click Configure Account > Create account manually.

    • Connectors

      1. Go to Projects > Connectors. All predefined connectors are listed in the right pane.

      2. Type JMS in the Search text box of the right pane. The matching connectors are listed.

      3. Click JMS.

    The Add account wizard appears.

  2. Enter the following details:

    • Name - Name of the account.

    • Description - Short description of the account.

    • Messaging provider template - Uses Universal Messaging in webMethods Cloud Container solution as the messaging provider if you select webMethods Cloud Container UM .

  3. Click Next. The JNDI Setting tab appears.

  4. Enter the following details:

    1. Provider URL - URL of the Universal Messaging server configured in webMethods Cloud Container. You can obtain the URL under Messaging Access Settings of the solution.

    2. Security principal- The principal name, or user name supplied by webMethods.io Integration to the JNDI provider, if the provider requires one for accessing the JNDI directory. Provide your webMethods Cloud Container tenant username. This is not required if you are connecting to webMethods Cloud Container Universal.

    3. Security credentials - The credentials, or password, that webMethods.io Integration provides to the JNDI provider, if the provider requires security credentials to access the JNDI directory. Provide your webMethods Cloud Container tenant password. This is not required if you are connecting to webMethods Cloud Container Universal Messaging using two-way SSL.

  5. Enter the following details to configure SSL settings:

    1. Two-Way SSL - Drag the switch to right to enable two-way SSL if you want to establish a two-way secure communication between webMethods.io Integration and the JNDI provider. By default, the option is disabled.

    2. Keystore alias - The alias for the keystore that contains the client certificates forwebMethods.io Integration to use when connecting to the JNDI provider.

    3. Key alias - The alias to the key that contains the private key for connecting to the JNDI provider. The key alias must be in the keystore specified in Keystore alias.

  6. Click Next. The JMS Setting tab appears.

  7. Enter the following details:

    1. Connection ClientID - JMS client identifier associated with the connections established by this account.

    2. JMS connection factory lookup name - The lookup name for the connection factory that you want to use to create a connection to the JMS provider specified in this JMS connection alias.

    3. Allow new connection per subscriber- Select this to create a new connection for each subscriber. Otherwise, all subscribers use same connection.

  8. Click Save. The account is configured.

Manage Subscriber State

The state of a subscriber indicates whether a subscriber is active or inactive. webMethods.io Integration allows you to view, change, and manage the state of a subscriber.

The states that can be set for a subscriber are: Enable, Disable, and Suspend. You may want to change the state of a subscriber in the following scenarios:

You can view the current state of a subscriber by going to the Subscribers page in Messaging.

Alternatively, you can view the subscriber state by going to the details page of a particular subscriber.

Subscriber State Behavior

Subscriber State Behavior
Enabled The subscriber is active and can receive and process messages.
Enabled but not running The subscriber is unable to connect to the messaging provider either because the account has been disabled or because the system is unable to reach the messaging provider.
Disabled The subscriber is unavailable and cannot receive and process any message.
Note: Subscribers that are Disabled can be enabled only using the user interface.
Suspended The subscriber is partially available. This means, the subscriber can process only existing messages but cannot receive any new messages.
Note: Subscribers can enter the Suspended state due to one of the two reasons:
  • A user has suspended a subscriber explicitly using the user interface.
  • The system suspends a subscriber for reasons like message processing error, server overload, and back-end system failure. In such cases, the subscriber is automatically enabled after the cause is addressed.
  • Not Configured The subscriber is not configured, that is, it does not have any routing rules defined and is marked with an orange warning icon. You can configure the subscriber using the Edit option either from the Subscribers page or from the corresponding Workflow.

    Changing Subscriber State

    1. Go to Messaging > Subscribers. The Subscribers page appears listing all existing subscribers. If subscribers are not yet created, you does not see the list.

    2. Click on the vertical ellipsis icon given against the subscriber.

    3. Select the state you want to set for the subscriber from the list of options that appear. When you change the state of a subscriber, webMethods.io Integration takes some time to update the change. During this time, new messages are retrieved and processed.

      Notes:

      • When you disable an enabled subscriber, webMethods.io Integration checks for existing and new messages. The existing messages that are currently being processed are allowed to complete, whereas messages that are awaiting to be processed are dropped and cannot be retrieved again. New messages are not fetched.
      • When you suspend an enabled subscriber, webMethods.io Integration allows existing messages that are currently being processed and messages that are awaiting to be processed to continue their normal course of execution. New messages are not fetched.
      • If you disable an enabled subscriber that is associated with a queue, webMethods.io Integration allows you to create a new subscriber on the same queue. This means, you can have only one active subscriber for a queue but can have multiple disabled subscribers for the same queue. This is applicable only for internal messaging providers.
      • If you want to enable a disabled subscriber that is associated with a queue, ensure that the queue is not associated with any other active subscriber. This is because there can only be one active subscriber for a queue.
      • You cannot suspend a disabled subscriber directly. If you want to suspend a disabled subscriber, you must enable it and suspend.

    Tips:

    Publish and Subscribe Messages using FlowServices

    Summary

    To publish and subscribe messages using queues and FlowServices. In this example, we will do the following high-level tasks:

    1. Create Queue - Create a queue Q1 to store messages received from publisher.

    2. Create Publisher - Create a FlowService, say Q1_publish_flowservice, to publish the messages to Q1.

    3. Create Subscriber - Create a subscriber, say Q1_subscriber, which subscribes to Q1 and runs a FlowService, Q1_consume_flowservice, to consume the messages.

    4. Publish Messages - Run the publisher and view the consumer FlowService execution logs.

    Basic Flow

    Create Queue

    1. Log in to webMethods.io Integration and create a project, for example, Messaging_Ops. You can also select an existing project.

    2. Go to Messaging. The Messaging - Queues page appears.

    3. Click Add Queue. The New Queue page appears.

    4. Enter the queue name as Q1.

    5. Click Save. The newly created queue details appear.

    Create Publisher

    1. Click Integrations > FlowServices. The FlowServices page appears.

    2. Click . The Start creating the FlowService page appears.

    3. Enter the FlowService name as Q1_publisher_flowservice.

    4. [Optional] Enter a short description of the FlowService under FlowService name.

    5. Type Messaging in the FlowService step1 and select Messaging from the list that appears. The fields associated with the Messaging application appears.

    6. Select the following options:

      a. Action - publish

      b. Destination type - Queue

      c. Destination - Q1

      Note: You can also add a new destination by clicking the Add Destination option.

      d. Account - Default account

    7. Click to map the input and output fields. The Pipeline panel appears.

    8. Double-click on the string field. The Set Value page appears.

    9. Enter the message I want to publish a message!.

    10. Click Save. The Pipeline panel appears.

    11. Close the Pipeline panel. The FlowService page appears.

    12. Click Save. The FlowService is ready to publish messages.

    Create Subscriber

    You can create the consumer FlowService in one of the following ways:

    Here, the steps are explained to create Q1_subscriber containing Q1_consume_flowservice from the Subscribers page.

    1. Go to Messaging > Subscribers. The Subscribers page appears.

    2. Click Add Subscriber. The New subscriber page appears.

    3. Enter the following details:

      a. Subscriber Name - Q1_subscriber

      b. Description - Consumes messages from Q1

      c. Connector Type - Messaging

      d. Account - Account that must be used to connect to the messaging provider. It is the DefaultAccount.

      e. Destination type- Queue

      f. Select destination- Q1

    4. Perform the following to set the Default invocation:

      a. Invocation type - FlowService

      b. Select invocation - Click and enter the name as Q1_consumer_flowservice in the New FlowService page.

      c. Click Save.

    5. Perform the following to add routing rules:

      a. Click Add routing rules. The New routing rule page appears.

      b. Enter the following details:

      i. Name - Rule 1

      ii. Filter - %body/string%==”Hello”

      iii. Invocation type - FlowService

      iv. Select Invocation - Click and enter the name as Rule1_invocation_flowservice in the New FlowService page.

      v. Click Save. The selected FlowService is added and is invoked if the incoming message criteria is satisfied.

      Note: You can choose an existing FlowService too. Only FlowServices that have JMS trigger specifications are listed in the Select Invocation field.

      c. Click Add. The new rule is created and listed under Routing rules.

      d. Repeat the sub steps in this step to add more rules if required.

    6. Click Save. The FlowService is added to the subscriber and the Subscriber details page appears.

      Note: Further, as you have created the consumer FlowService from the Subscribers page, the trigger specification reference appears automatically.

    7. Click Save. The subscriber is created with the Q1_consumer_flowservice that consumes messages arriving in Q1.

    Publish Messages

    1. Open the Q1_publisher_flowservice.

    2. Click . If the Q1_publisher_flowservice runs successfully, the Q1_consumer_flowservice runs automatically. The Q1_publisher_flowservice sends the message to the queue Q1 and as the Q1_Subscriber is listening to Q1, it runs the Q1_consumer_flowservice created in the Q1_Subscriber.

    3. Go to Monitor > Execution results > FlowService execution. The FlowService execution statistics appear.

    4. Go to the Executions section. You can observe that the Execution source column for the:

      • Q1_consumer_flowService is Messaging Subscriber.

      • Q1_publisher_flowService is User Interface.

    In this way, you can publish and subscribe messages using FlowServices.

    Publish and Subscribe Messages Using Workflows

    Summary

    To publish and subscribe messages using topic and Workflows. In this example, we will do the following high-level tasks:

    1. Create Publisher - Create a Workflow, say T1_publish_workflow, to publish the messages to topic T1.

    2. Create Subscriber - Create a Subscriber, say T1_subscriber, which subscribes to T1 and runs a Workflow, T1_subscriber_workflow, to consume the messages.

    3. Publish Messages - Run the publisher and view the consumer Workflow execution logs.

    Basic Flow

    Create Publisher

    1. Log in to webMethods.io Integration and create a project, for example, Messaging_Ops. You can also select an existing project.

    2. Click Integrations > Workflows. The Workflows page appears.

    3. Click . The Start Building your Workflow page appears.

    4. Click Create New Workflow to start creating a Workflow to publish the message. The Workflow canvas appears.

    5. Drag and drop the Messaging connector on to the canvas from the right-side Search pane.

    6. Click the warning icon on the Messaging connector. The Messaging page appears.

    7. Provide the following details to configure the Messaging connector:

      a. Select action - publish

      b. Name - T1_publisher

      c. Destination Type - Topic

      d. Destination - T1 (You can also add a new destination by clicking )

      e. Connect to Messaging - DefaultAccount

      f. Click Next. The T1_publisher page appears.

      g. Type the message, Hello! I’m publishing a message, in the string field.

      h. Click Next. The Test this action page appears.

      i. Click Test. The Output tab shows that the message has been posted.

      j. Click Done. The Workflow canvas page appears.

    8. Connect the Messaging step to the Stop button.

    9. Provide a name for the Workflow, T1_publisher_workflow.

    10. Click Done. The Workflow name is updated.

    11. Save the Workflow.

    Create Subscriber

    1. Click Integrations > Workflows. The Workflows page appears.

    2. Click . The Start Building your Workflow page appears.

    3. Click Create New Workflow to start creating a Workflow for subscribing messages. The Workflow canvas appears.

    4. Click the Settings icon on the Start step . The Trigger page appears.

    5. Search and select the Messaging Service trigger.

    6. Click Next. The Messaging Service page appears.

    7. Perform the following steps to add a subscriber:

      a. Click . The Add subscriber page appears.

      b. Subscriber Name - T1_subscriber

      c. Description - Consumes messages received from T1

      d. Destination type - Topic

      e. Destination - T1

      f. Click Save. The subscriber is created.

    8. Perform the following to add filters:

      a. Click Add Filters. The filter fields appear.

      b. Enter the following details:

      i. Name - F1.

      ii. Filter Expression - %body/string%==”Hello”.

      iii. Repeat the previous two steps to add more filters.

    9. Click Save. The Test trigger page appears.

      Note: If you want to test the trigger, you must first publish a message and then click the Test button to see whether the message is received.

    10. Click Skip. The Trigger output data page appears.

    11. Click Done. The Workflow canvas appears.

    12. Search for the Logger connector and drag and drop the Logger connector on to the canvas.

    13. Click the warning icon on the Logger. The Logger page appears.

    14. Click Next. The Logger fields appear.

    15. Drag and drop string to the Log Data field.

    16. Click Next. The Test this action page appears.

    17. Click Done. The Workflow canvas appears.

    18. Connect Logger to the Stop step.

    19. Provide a name and description for the Workflow.

    20. Save the Workflow. Now the Workflow is ready to receive messages and process further steps based on the filters specified.

    Publish Messages

    1. Open the T1_publish_workflow from the Workflows page.

    2. Click .

    3. Go to Monitor > Execution results > Workflow execution. The Workflow execution statistics appear. You can observe that the Execution source column for the:

      • T1_subscriber_workflow is Trigger.

      • T1_publisher_workflow is Manual.

    In this way, you can publish and subscribe messages using Workflows.

    Publish and Consume a Document

    Summary

    The following high-level tasks are demonstrated in this example:

    1. Create a topic, todays_quote.

    2. Create a document type, doc_quote from scratch to publish.

    3. Create a publisher FlowService, publish_doc_quote, to publish a document.

    4. Create a consumer FlowService, consume_doc_quote, that logs the same data sent in the published document.

    5. Create a subscriber, todays_quote_subscriber, to consume messages published to topic.

    6. Create a consumer workflow, todays_quote_subscriber2, that logs the same data sent in the published document.

    7. Run the publisher FlowService and check if both the consumers have executed successfully.

    Basic Flow

    Create Topic

    1. Log in to webMethods.io Integration and create a project, for example, Messaging_Ops. You can also select an existing project.

    2. Click Messaging > Topics. The Messaging - Topics page appears.

    3. Click Add Topic. The New topic page appears.

    4. Enter the topic name as, todays_quote.

    5. Save the topic. The newly created topic details appear.

    Create Document Type

    1. Go to Configurations > FlowService > Document Types > Add Document Type. The Add new Document type dialog box appears.

    2. Select Build from scratch.

    3. Click OK. The Add new Document type page appears.

    4. Click Load JSON. The Type or paste JSON content text box appears.

    5. Paste the content.

    6. Click Load JSON. The Add new Document type page appears.

    7. Click Save. The newly created document type appears under Document Types.

    Create Publisher

    1. Click Integrations > FlowServices. The FlowServices page appears.

    2. Click . The Start creating the FlowService page appears.

    3. Enter the FlowService name as publish_doc_quote.

    4. [Optional] Enter a short description of the FlowService under FlowService name.

    5. Type Messaging in the FlowService step 1 and select Messaging from the list that appears. The fields associated with the Messaging application appears.

    6. Select the following options:

      a. Action - publish

      b. Destination type - Topic

      c. Destination - todays_quote

      d. Account - Default account

    7. Click Define I/O. The Define input and output fields page appears.

    8. Select the Add a new set option. The data fields appear.

    9. Enter the following details:

      a. Name - quote

      b. Type - Document Reference

      c. Document reference - doc_quote

    10. Click Done. The FlowService page appears.

    11. Click to map the input and output fields. The Pipeline panel appears.

    12. Map the quote document reference from the input pipeline to the data field in the JMS message body.

    13. Click Save.

    14. Close the Pipeline panel. The FlowService page appears.

    15. Click Save. The FlowService is ready to publish messages.

    Create Consumer FlowService

    1. Click Integrations > FlowServices. The FlowServices page appears.

    2. Click . The Start creating the FlowService page appears.

    3. Enter the FlowService name as consume_doc_quote.

    4. [Optional] Enter a short description of the FlowService under FlowService name.

    5. Click Define I/O. The Define input and output fields page appears.

    6. Select Specification Reference.

    7. Select the Messaging Service.

    8. Click Done. The FlowService page appears.

    9. Do the following steps in order to retrieve fields of the published quote document, you must first map the data to doc_quote in the transform pipeline step.

      a. Type Transform in the FlowService step 1 and select Transform Pipeline from the list that appears.

      b. Click to map the input and output fields. The Pipeline panel appears.

      c. Click in the Pipeline Output. The Pipeline output page appears.

      d. Enter the following details:

      i. Name - doc_quote

      ii. Type - Document Reference

      iii. Document reference - doc_quote

      e. Click Save. The Pipeline panel appears.

      f. Map the data field under the JMSMessage body to the newly created doc_quote field.

      g. Close the Pipeline panel. The FlowService page appears.

    10. Do the following step to log the quote that is received:

      a. Type logCustomMessage in the FlowService step 1.

      b. Click to map the input and output fields. The Pipeline panel appears.

      c. Double-click message under the Input column. The Set Value page appears.

      d. Add the custom message: Today’s quote is “%/doc_quote/content%“, by “%/doc_quote/author%.

      e. Select Perform pipeline variable substitution.

      f. Click Save. The Pipeline panel appears.

    11. Close the Pipeline panel. The FlowService page appears.

    12. Click Save.

    Create Subscriber

    Create a subscriber, todays_quote_subscriber, for consuming the messages sent to the topic todays_quote.

    1. Go to Messaging > Subscribers. The Subscribers page appears.

    2. Click Add Subscriber. The New subscriber page appears.

    3. Enter the following details:

      a. Subscriber Name - todays_quote_subscriber

      b. Description - Consumes messages from todays_quote

      c. Connector Type - Messaging

      d. Account - Account that must be used to connect to the messaging provider. It is the DefaultAccount.

      e. Destination type- Topic

      f. Select destination- todays_quote

      g. Invocation type - FlowService

      h. Select invocation - consume_doc_quote

    4. Click Save. The subscriber is created.

    Create Consumer Workflow

    Create another subscriber, todays_quote_subscriber2, for consuming the messages sent to the topic, todays_quote.

    1. Click Integrations > Workflows. The Workflows page appears.

    2. Click . The Start Building your Workflow page appears.

    3. Click Create New Workflow to start creating a Workflow for subscribing messages. The Workflow canvas appears.

    4. Click the Settings icon on the Start step . The Trigger page appears.

    5. Search and select the Messaging Service trigger.

    6. Click Next. The Messaging Service page appears.

    7. Perform the following steps to add a subscriber:

      a. Click . The Add subscriber page appears.

      b. Subscriber Name - todays_quote_subscriber2

      c. Description - Consumes messages received from todays_quote

      d. Destination type - Topic

      e. Destination - todays_quote

      f. Click Save. The subscriber is created.

    8. Click Save. The Test trigger page appears.

      Note: If you want to test the trigger, you must first publish a message and then click the Test button to see whether the message is received.

    9. Open the publisher FlowService publish_doc_quote in a separate tab.

    10. Click . The Input values page appears.

    11. Add the input values as shown:

    12. Click Run. The Run Successful message appears if the FlowService runs successfully.

    13. Go to the previous tab where the consume_doc_quote_workflow is open.

    14. Click Test. The OUTPUT tab contains the document that was published in the earlier step.

    15. Click Done. The Workflow canvas appears.

    16. Search for the Logger connector and drag and drop the Logger connector on to the canvas.

    17. Click the warning icon on the Logger. The Logger page appears.

    18. Click Next. The Logger fields appear. Note that the quote document is available in the JMS message body data fields.

    19. Paste the following text in the log data box: Today’s quote is “{{$trigger.JMSMessage.body.data.content}}” by {{$trigger.JMSMessage.body.data.author}}.

    20. Click Next. The Test this action page appears.

    21. Click Done. The Workflow canvas appears.

    22. Connect Logger to the Stop step.

    23. Provide a name and description for the Workflow.

    24. Save the Workflow.

    Publish Messages

    1. Open the publish_doc_quote flowservice.

    2. Click . The Input values page appears.

    3. Add the input values as shown:

    4. Click Run. The Run Successful message appears if the FlowService runs successfully. The document is published to topic.

    5. Go to Monitor > Execution results > FlowService execution. The FlowService execution statistics appear. You can observe that status is success.

      Also, the message is logged.

    6. Go to Monitor > Execution results > Workflow execution. The Workflow execution statistics appear.

    7. Select the logger step to see the log message

    Publish and Subscribe Messages Using External Messaging Provider - JMS Connector

    Summary

    To publish and subscribe messages using the JMS connector.

    1. Create Publisher - Create a FlowService, say publish_flowservice, to publish the messages to topic, JMSTopic.

    2. Create Subscriber - Create a subscriber, say JMSsubscriber, which subscribes to JMSTopic and runs a FlowService, JMSTopic_consumer_flowService , to consume the messages.

    3. Publish Messages - Run the publisher and view the consumer FlowService execution logs.

    Basic Flow

    Prerequisites

    Create Publisher

    1. Click Integrations > FlowServices. The FlowServices page appears.

    2. Click . The Start creating the FlowService page appears.

    3. Enter the FlowService name as publisher_flowservice.

    4. [Optional] Enter a short description of the FlowService under FlowService name.

    5. Type JMS in FlowService step1 and select JMS from the list that appears. The fields associated with the JMS connector appears.

    6. Select the following options:

      1. Action - send

      2. Account - account that must be used to connect to the JMS connector. You can configure a new account if an account is not available. For more information, see Configuring JMS Connector Account.

    7. Click to map the input and output fields. The Pipeline panel appears.

    8. Double-click destinationName to specify the destination to which the messages must be published. The Set Value - destinationName dialog box appears.

    9. Enter the name of the destination. For example, JMSTopic.

    10. Double-click on the string field. The Set Value - string page appears.

    11. Enter the message I want to publish a message!

    12. Click Save. The Pipeline panel appears.

    13. Close the Pipeline panel. The FlowService page appears.

    14. Click Save. The FlowService details are saved.

    Create Subscriber

    You can create the consumer FlowService in one of the following ways:

    Here, the steps are explained to create the JMSTopic_consumer_flowService from the Subscribers page.

    1. Go to Messaging > Subscribers. The Subscribers page appears.

    2. Click Add Subscriber. The New subscriber page appears.

    3. Enter the following details:

      1. Subscriber Name - JMSSubscriber

      2. Description - Subscribes for messages published to JMSTopic

      3. Connector Type - JMS

      4. Account - Account that must be used to connect to JMS provider

      5. Destination type- Topic

      6. Select destination- JMSTopic

    4. Perform the following to set the Default invocation:

      1. Invocation type - FlowService

      2. Select invocation :

        1. Click . The New FlowService page appears.

        2. Enter the name as JMSTopic_consumer_flowservice.

        3. Click Save.

    5. Click Save. The JMSSubscriber is created with the JMSTopic_consumer_flowService that consumes messages arriving in JMSTopic.

    Publish Messages

    1. Open the publisher_flowservice.

    2. Click . If the publisher_flowservice runs successfully, the JMSTopic_consumer_flowService runs automatically. The publisher_flowservice sends the message to the topic JMSTopic and as the JMSSubscriber is listening to topic, it runs the JMSTopic_consumer_flowService created in the JMSSubscriber.

    3. To verify if the consumer FlowService ran:

      1. Go to Monitor > Execution results > FlowService execution. The FlowService execution statistics appear.

      2. Go to the Executions section. You can observe that the Execution source column for the:

        • JMSTopic_consumer_flowService is Messaging Subscriber.

        • publisher_flowService is User Interface.

    In this way, you can publish and subscribe messages using the JMS connector.