Introduction

Setup

All values expected to configure rabbit-client can be set via environment variables.

Default values

# client
BROKER_HOST=localhost
BROKER_PORT=5672

# publish/producer
PUBLISH_EXCHANGE=default.out.exchange
PUBLISH_EXCHANGE_TYPE=topic
PUBLISH_TOPIC=#
PUBLISH_QUEUE=default.publish.queue

# subscribe/consumer
SUBSCRIBE_EXCHANGE=default.in.exchange
SUBSCRIBE_EXCHANGE_TYPE=topic
SUBSCRIBE_TOPIC=#
SUBSCRIBE_QUEUE=default.subscribe.queue

# dlx
DLX_EXCHANGE=DLX
DLX_TYPE=direct
DQL_QUEUE=default.subscribe.queue.dlq

# polling
POLLING_STANDBY_TIME=10
EVENT_SCHEMA=my_schema
DATABASE_DRIVER=postgresql://postgres:postgres@localhost:5432/db
ALEMBIC_FILE=
SCRIPT_LOCATION=

Polling-Plublisher

This resource needs a database to store event data. By default the below structure will be created on startup.

Sequence: my_schema

This value can be changed setting environment variable EVENT_SCHEMA.

Table: myschema.event

column type description
id Integer primary key, auto-incremented by sequence value.
body LargeBinary event payload processed.
created_at DateTime datetime that the event processed was stored.
created_by String(100) this field will be filled if the event received have in your body createdBy otherwise the value will be anonymous.
status Boolean When the event is stored this field will be set to False and as the polling retrieve the oldest event and send successfully the event to broker this field will be changed to True.

If you wish change some migration logic, as for example, apply some script after the execution of each migration could you change the default alembic.ini as migrations managed by rabbit-client. For this use case just set the environment variable ALEMBIC_FILE and SCRIPT_LOCATION.