Last active
February 15, 2018 08:54
-
-
Save tomconte/c94af7efeccb2a274b82 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