Created
May 22, 2012 18:29
-
-
Save slacy/2770786 to your computer and use it in GitHub Desktop.
Kombu vs. boto
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 boto | |
from kombu import BrokerConnection, Queue | |
def main(): | |
queue = Queue("steve-test-kombu") | |
with BrokerConnection('sqs://<KEY_ID>@<ACCESS_KEY>:80/') as connection: | |
connection.connect() | |
queue(connection.channel()).declare() | |
with connection.Producer(serializer="raw") as producer: | |
producer.publish('hello world') | |
def boto_main(): | |
boto_conn = boto.connect_sqs() | |
queue = boto_conn.get_queue('steve-test-kombu') | |
msg = queue.new_message(body='hello world') | |
queue.write(msg) | |
boto_conn.close() | |
if __name__ == '__main__': | |
main() | |
boto_main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ideally, I'd like main() and boto_main() to produce the exact same message into the queue, but this isn't currently happening. The one from kombu is significantly longer, even though I'm using the 'raw' encoding and no compression...