Pub-Sub Usage Example
Related pages:
Pub-Sub
Pub-Sub Technical Notes
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.
Also, prepare our Subscribers. For the example, we will use three flows, each of which will perform a specific function.
First flow - E-mail sender
The first flow takes some fields from the received message and does an E-mail to the required addresses.
Second flow - Write statistics in Spreadsheets
The second flow writes the necessary information in Google 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.
By sending a request to Webhook in the Publisher thread we start three flows at once.
Result of three flows
As a result, we will get:
- an E-mail to the specified address:
- a Google Spreadsheet with the selected data:
- a CSV document on the remote server:
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.