Publishing and consuming documents
Tutorial to publish and consume messages by using documents.
About this task
Publishing and consuming messages by using documents involves the following high-level tasks:
- Create a topic, todays_quote.
- Create a document type, doc_quote from scratch to publish.
- Create a publisher flow service, publish_doc_quote, to publish a document.
- Create a consumer flow service, consume_doc_quote, that logs the same data that is sent in the published document.
- Create a subscriber, todays_quote_subscriber, to consume messages that are published to the topic.
- Create a consumer workflow, todays_quote_subscriber2, that logs the same data that is sent in the published document.
- Run the publisher flow service and check whether both the consumers ran successfully.
Creating topics
Procedure
- In Projects, create a project, for example, Messaging_Ops. You can also select an existing project.
- Go to .
- Click Messaging destinations. The Queues page is displayed.
- Click Topics. The Topics page is displayed.
- Click Add Topic. The New topic page is displayed.
- Enter the topic name as, todays_quote.
- Save the topic. The newly created topic details appear.
Creating document types
Procedure
- Go to . The Add new Document type dialog box is displayed.
- Select Build from scratch.
- Click OK. The Add new Document type page is displayed.
- Click Load JSON. The Type or paste JSON content text box is displayed.
- Paste the content.
- Click Load JSON. The Add new Document type page is displayed.
- Click Save. The newly created document type is displayed under Document Types.
Creating publishers
Procedure
Creating consumer flow service
Procedure
Creating subscribers
About this task
Procedure
Creating consumer workflows
About this task
Procedure
Publishing messages
Procedure
- Open the publish_doc_quote flowservice.
- Click Run. The Input values page is displayed.
- Add input values for the _id, content, author, authorid, and length fields.
- Click Run. The Run Successful message is displayed if the flow service runs successfully. The document is published to the topic.
- Go to .
The flow service execution statistics appear. The message is logged.
- Go to . The Workflow execution statistics appear.
- Select the logger step to see the log message.