Last active
August 6, 2019 07:12
-
-
Save nvllsvm/65e5f78347fa58f7e48dcafa0bef1c0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.4' | |
services: | |
example: | |
image: python:alpine | |
command: ['sh', '-c', 'pip install rabbitpy && python /example/example.py'] | |
volumes: | |
- ./:/example | |
rabbitmq: | |
image: rabbitmq:alpine | |
ports: | |
- 5672:5672 | |
- 15672:15672 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rabbitpy | |
import sys | |
import time | |
if sys.platform == 'darwin': | |
url = 'amqp://guest:guest@localhost:5672/%2f' | |
else: | |
url = 'amqp://guest:guest@rabbitmq:5672/%2f' | |
conn = rabbitpy.Connection(url) | |
channel = conn.channel() | |
# manually enable this later | |
## channel.enable_publisher_confirms() | |
while True: | |
print('Publishing!') | |
message = rabbitpy.Message(channel, b'content') | |
message.publish('amq.topic', 'rk') | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's not a missing timeout, as the timeout value is the same for READ, WRITE, and ERROR:
https://github.com/gmr/rabbitpy/blob/master/rabbitpy/io.py#L85
it's the difference between kqueue and poll. I've not been in this code for some time, but it's likely around event registration and may even be a Python level bug. I'm poking around on it.