RabbitMQ – integration with Storm
Now that we have accomplished basic setup and publish, and subscribe next let's move on to integration of RabbitMQ with Storm. We'll execute this as an end-to-end example.
AMQPSpout
Storm integrates with RabbitMQ using an AMQPSpout
, which reads the messages from RabbitMQ and pushes them to Storm topology for further processing. The following code snippet captures the key aspects of encoding the AMQPSpout
:
.. public class AMQPSpout implements IRichSpout { private static final long serialVersionUID = 1L; /** * Logger instance */ private static final Logger log = LoggerFactory.getLogger(AMQPSpout.class); private static final long CONFIG_PREFETCH_COUNT = 0; private static final long DEFAULT_PREFETCH_COUNT = 0; private static final long WAIT_AFTER_SHUTDOWN_SIGNAL = 0; private static final long WAIT_FOR_NEXT_MESSAGE = 1L; private static final String EXCHANGE_NAME = "MYExchange"; ...