Apache Storm Spouts are used to perform the transformation of streams. In Storm cluster, it acts as a source of Steam because topology begins with a Spout. It provides an interface to run application-based logic, for example, Spouts can connect with Twitter API and produce a stream of Tweets.
The following are some practices to design Apache Storm Spouts that will gather data from multiple data sources effectively.
- Direct Connection Spout
- Queue System
Let us see each practice in detail.
1. Direct Connection Spout
Direct Connection architecture is very simple and easy to implement in which Spout connects with message emitter directly. An example of a direct connection is to create a Spout to read Tweets by using Twitter streaming API in which Spout will directly connect with Twitter API that will act as message emitter.
The following figure shows the Direct Connection architecture of Spout.
2. Queue System
In this architecture, there is a Queue system through which Spouts are connected. Now queue system will receive a message from message emitters and then Spouts will consume messages from the Queue system. The main benefit of the Queue system is that it acts as a middleware service between Spouts and the source system.
The following figure shows the Queue System Architecture of Spout.