Covered in this article
Related pages
Latest Changelog
Version 1.0.9 ()
Pub-Sub component

Pub-Sub Usage Example

Usage Example for the Pub-Sub component.

Introduction

Now let’s move on to the implementation of our Publisher flow. Let’s imagine that some service collects news from some resources and transmits the data within our Topic template to the flow via Webhook. After that, we put the Pub-Sub component in Publisher mode and configure it as follows: specify the Topic we created earlier, then in the mapping tab based on our JSON schema we will need to specify the contents of the fields of this schema.

Pub-Sub Configuration

Also, prepare our Subscribers. For the example, we will use three flows, each of which will perform a specific function.

Three flows

First flow - E-mail sender

The first flow takes some fields from the received message and does an E-mail to the required addresses.

E-mail sender

Second flow - Write statistics in Spreadsheets

The second flow writes the necessary information in Google Spreadsheets.

Write statistics in Spreadsheets

Third flow - Write data to FTP

The third flow is a prototype of the database, which should store all the data obtained. For a simpler implementation, a CSV document was chosen, which is stored on a remote FTP Server.

CSV configuration

By sending a request to Webhook in the Publisher thread we start three flows at once.

Executions

Result of three flows

As a result, we will get:

  • an E-mail to the specified address:

New Mail

  • a Google Spreadsheet with the selected data:

News Statistics Spreadsheet

  • a CSV document on the remote server:

CSV Table

Conclusion

As a result, the PubSub component is a powerful tool to perform any number of asynchronously performed tasks on a specified data template, with the ability to select specific data from Topic and further manipulate them, which simplifies the work and increases the speed of tasks of various types.

Click here to learn more about the elastic.io iPaaS