Publish and Subscribe Messages Using External Messaging Provider - JMS Connector
Summary
To publish and subscribe messages using the JMS connector.
- Create Publisher - Create a flow service, say publish_flowservice, to publish the messages to topic, JMSTopic.
- Create Subscriber - Create a subscriber, say JMSsubscriber, which subscribes to JMSTopic and runs a flow service, JMSTopic_consumer_flowService , to consume the messages.
- Publish Messages - Run the publisher and view the consumer flow service execution logs.
Basic Flow
Prerequisites
- Access to Universal Messaging.
- Universal Messaging must have connection factory in the JNDI context.
- If you want to use Two-Way SSL, then the appropriate client certificate generated from IBM webMethods Cloud Container must be uploaded in IBM webMethods Integration under . For more information about client certificate, see Two-Way SSL and Messaging in IBM webMethods Cloud Container documentation.
Create Publisher
- Click . The Flow services page appears.
- Click Add. The Start creating the Flow service page appears.
- Enter the flow service name as publisher_flowservice.
- Enter a short description of the flow service under Flow service name.
- Type JMS in flow service step1 and select JMS from the list that appears. The fields associated with the JMS connector appears.
- Select the following options:
- Action - send
- 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 JMS Connector Parameters in External Messaging Providers .
- Click Pipeline to map the input and output fields. The Pipeline page appears.
- Double-click destinationName to specify the destination to which the messages must be published. The Set Value - destinationName dialog box appears.
- Enter the name of the destination. For example, JMSTopic.
- Double-click on the string field. The Set Value - string page appears.
- Enter the message I want to publish a message!
- Click Save. The Pipeline page appears.
- Close the Pipeline page. The flow service page appears.
- Click Save. The flow service details are saved.
Create Subscriber
You can create the consumer flow service in one of the following ways:
- Directly from the flow services page.
- Create the flow service when creating a subscriber. The subscriber listens to messages that the topic receives. If the topic receives messages, then the consumer flow service in the subscriber runs automatically.
Here, the steps are explained to create the JMSTopic_consumer_flowService using Messaging.
- Go to .
- Click Add new subscriber. The New subscriber page appears.
- Enter the following details:
- Subscriber Name - JMSSubscriber
- Description - Subscribes for messages published to JMSTopic
- Connector Type - JMS
- Account - Account that must be used to connect to JMS provider
- Destination type - Topic
- Select destination - JMSTopic
-
Perform the following to set the Default invocation.
- Invocation type - Flow service
- Select invocation -
- Click Add. The New Flow service page appears.
- Enter the name as JMSTopic_consumer_flowservice.
- Click Save.
- Click Save. The JMSSubscriber is created with the JMSTopic_consumer_flowService that consumes messages arriving in JMSTopic.
Publish Messages
- Open the publisher_flowservice.
- Click Run. 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.
-
To verify if the consumer Flow service ran:
- Go to . The flow service execution statistics appear.
- 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.