How to do it...

Once you have installed the SNAS BMP message API and started ZooKeeper server and Kafka server as shown previously, you are ready to run a simple listener for the BMP messages.

First, start the Python client of the SNAS message API:

$ python 13_3_log_consumer.py
Connecting to kafka... takes a minute to load offsets and topics, please wait
Now consuming/waiting for messages...

13_3_snas_log_consumer.py is adopted from openbmp-python-api-message/examples/log_consumer.py.

Now, if you run the following from another Terminal and send an empty message using the Enter key in your keyboard:

$ kafka_2.11-0.11.0.0/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic openbmp.parsed.router
>
>

You will receive the following ...

Get Python Network Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.