AMQP API Client

class dbrepo.AmqpClient.AmqpClient(broker_host: str = 'localhost', broker_port: int = 5672, broker_virtual_host: str = 'dbrepo', username: str = None, password: str = None)

The AmqpClient class for communicating with the DBRepo AMQP API to import data. All parameters can be set also via environment variables, e.g. set endpoint with DBREPO_ENDPOINT. You can override the constructor parameters with the environment variables.

Parameters:
  • broker_host – The AMQP API host. Optional. Default: “localhost”.

  • broker_port – The AMQP API port. Optional. Default: 5672,

  • broker_virtual_host – The AMQP API virtual host. Optional. Default: “dbrepo”.

  • username – The AMQP API username. Optional.

  • password – The AMQP API password. Optional.

publish(routing_key: str, data=<class 'dict'>, exchange: str = 'dbrepo') None

Publishes data to a given exchange with the given routing key with a blocking connection.

Parameters:
  • routing_key – The routing key.

  • data – The data.

  • exchange – The exchange name. Default: “dbrepo”.