Skip to content

Latest commit

 

History

History

amqp-pub-sub

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Asyncapi-Python AMQP Pub-Sub Example

The following example shows how to use asyncapi-python package to create publisher-subscriber communications.

Requirements

  1. A working amqp broker

    This example assumes that it will be accessible by amqp://guest:guest@localhost. If this is not true, set AMQP_URI envvar accordingly

Steps

  1. cd into this directory

  2. Create python virtual environment and activate it.

    Alternatively, run make venv install.

    python3 -m venv .venv
    . .venv/bin/activate
  3. Generate client and server modules.

    Alternatively, run make generate.

    asyncapi-python-codegen spec/publisher.asyncapi.yaml publisher --force
    asyncapi-python-codegen spec/subscriber.asyncapi.yaml subscriber --force
  4. Run subscriber, and then publisher. This requires two terminals.

    .venv/bin/python main-subscriber.py
    .venv/bin/python main-publisher.py