Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions graypy/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from logging import Filter
from logging.handlers import SocketHandler

from amqplib import client_0_8 as amqp # pylint: disable=import-error
import amqp # pylint: disable=import-error

from graypy.handler import BaseGELFHandler

Expand Down Expand Up @@ -73,7 +73,7 @@ def __init__(self, url, exchange='logging.gelf', exchange_type='fanout',
**kwargs
)
SocketHandler.__init__(self, host, port)
self.addFilter(ExcludeFilter('amqplib'))
self.addFilter(ExcludeFilter('amqp'))

def makeSocket(self, timeout=1):
return RabbitSocket(self.cn_args, timeout, self.exchange,
Expand All @@ -93,6 +93,7 @@ def __init__(self, cn_args, timeout, exchange, exchange_type, routing_key):
self.routing_key = routing_key
self.connection = amqp.Connection(
connection_timeout=timeout, **self.cn_args)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that the amqp.Connection class expects connect_timeout instead of connection_timeout keyword parameter. This is actually a bug also with current amqplib.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, good find.

self.connection.connect()
self.channel = self.connection.channel()
self.channel.exchange_declare(
exchange=self.exchange,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def run_tests(self):
"pylint>=1.9.3,<2.0.0",
"mock>=2.0.0,<3.0.0",
"requests>=2.20.1,<3.0.0",
"amqplib>=1.0.2,<2.0.0"
"amqp>=2.4.2,<2.5.1"
],
extras_require={
'amqp': [
'amqplib==1.0.2'
'amqp==2.4.2'
],
"docs": [
"sphinx>=2.1.2,<3.0.0",
Expand Down