-
-
Save rcarmo/dcdcf6702ef42dca7552 to your computer and use it in GitHub Desktop.
Send messages to an Azure Event Hub using the Apache Qpid Proton AMQP library.
This file contains hidden or 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
#!/usr/bin/python | |
# Send messages to an Azure Event Hub using the Apache Qpid Proton AMQP library. | |
import sys | |
import commands | |
from proton import * | |
# Event Hub address & credentials | |
# amqps://<keyname>:<key>@<namespace>.servicebus.windows.net/<eventhubname> | |
# You can find <keyname> and <key> in your Service Bus connection information | |
# <key> needs to be URL-encoded | |
# <namespace> is your SB top-level namespace | |
# <eventhubname> is the name of your Event Hub | |
address = "amqps://send:[email protected]/yun"; | |
# Create Proton objects | |
messenger = Messenger() | |
# Create AMQP message | |
message = Message() | |
message.body = sys.argv[1] | |
message.address = address | |
messenger.put(message) | |
messenger.send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment