O'Reilly logo

Python Network Programming Cookbook - Second Edition by Dr. M. O. Faruque Sarker, Pradeeban Kathiravelu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required