pikachewie.helpers – Helpers for creating brokers and agents¶
-
pikachewie.helpers.
broker_from_config
(config)¶ Create a
pikachewie.broker.Broker
from the given config.
-
pikachewie.helpers.
consumer_agent_from_config
(config, name, broker='default', section='rabbitmq')¶ Create a
pikachewie.agent.ConsumerAgent
from the given config.The config dict should have a structure similar to the following example:
{ 'rabbitmq': { 'brokers': { 'default': { 'nodes': { 'rabbit1': { 'host': 'rabbit1.example.com', 'port': 5672, }, 'rabbit2': { 'host': 'rabbit2.example.com', 'port': 5672, }, }, 'virtual_host': '/integration', 'heartbeat_interval': 60, }, }, 'consumers': { 'message_logger': { 'class': 'my.consumers.LoggingConsumer', 'arguments': { 'level': 'debug', }, 'bindings': [ { 'exchange': 'message', 'queue': 'text', 'routing_key': 'example.text.#', }, ], }, }, 'exchanges': { 'message': { 'exchange_type': 'topic', 'durable': True, 'auto_delete': False, }, }, 'queues': { 'text': { 'durable': True, 'exclusive': False, 'arguments': { 'x-dead-letter-exchange': 'dead.letters', 'x-dead-letter-routing-key': 'omg.such.rejection', 'x-ha-policy': 'all', 'x-message-ttl': 1800000 }, }, }, }, }
-
pikachewie.helpers.
consumer_from_config
(config)¶ Create a
pikachewie.consumer.Consumer
from the given config.