def __init__(self, **kwargs):
"""Builds a new instance of the AMQP output adapter.
Parameters
----------
kwargs: dict
AMQP configuration
"""
Output.__init__(self)
self._username = kwargs.pop('username', 'guest')
self._password = kwargs.pop('password', 'guest')
self._host = kwargs.pop('host', '127.0.0.1')
self._port = kwargs.pop('port', 5672)
self._vhost = kwargs.pop('vhost', '/')
self._delivery_mode = kwargs.pop('delivery_mode', 1)
credentials = pika.PlainCredentials(self._username, self._password)
self._parameters = pika.ConnectionParameters(self._host,
self._port,
self._vhost,
credentials)
self._exchange = kwargs.pop('exchange', None)
self._routingkey = kwargs.pop('routingkey', None)
self._connection = None
self._channel = None
self._basic_props = pika.BasicProperties(content_type='text/json',
delivery_mode=self._delivery_mode)
评论列表
文章目录