Created
March 5, 2019 17:39
-
-
Save deeTEEcee/237196bbf5aebeaaba194d2028f8516f to your computer and use it in GitHub Desktop.
py-amqp examples
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
# Created these after looking at unit tests. Couldn't really find any other online examples. | |
from io import BytesIO | |
from amqp import Connection | |
import pprint | |
import pickle | |
connection = Connection() | |
channel = connection.channel() | |
message = channel.basic_get(queue='gegroby/ma.model.cycle.finalcal/analytics_finalcal/') | |
# channel.basic_ack(message.delivery_tag) acknowledge. otherwise, the same message will keep getting fetched at every attempt. | |
result = pickle.load(BytesIO(message.body)) | |
pprint.pprint(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment