Skip to content

boisgera/NATS

Repository files navigation

NATS

The "Neural Autonomic Transport System", a cross-platform messaging technology.

NATS logo

Prerequisites

Learn the basics of Python async:

For further information, refer to the asyncio documentation.

Getting Started

Primitives

Learn the basics of the NATS Python client API:

  • connect

  • subscribe

  • publish

  • Subscription and Subscription.next_msg,

  • Message, Message.data and Message.reply.

Practice

  • Identity. Select an name to identify yourself (e.g. boisgera for myself).

  • Heartbeat. Send every second a message with subject "❤️" and with data your (utf-8 encoded) name.

  • Alive Create a python file with an async function alive that list (once, alphabetically) each name that has at least one heartbeat over a 3.0 second. Print each name on a line when the python file is invoked as a script.

  • Watcher. Use rich to make a script that continuously display the list of heartbeat names.

  • Inbox. Subscribe to the channel which is your name and print every message that you receive in this channel. Combine this program with the publication of your heartbeat.

  • Greetings. Send a (utf-8 encoded) greeting message to a person who has a heartbeat.

  • Reply. Send another message to someone with a specific question. Specify the reply argument to publish in order to get an answer!

  • Replies. There are several way to identify among all the messages that you get which one correspond to the answer to a specific message you get. One way consists in using an ephemeral channel which you will use only for this answer, and specify its (uniquely generated name) in the reply argument.

  • JSON. Make some NATS server to provide access to search Chuck Norris Jokes and also make the corresponding client.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages