コード例 #1
0
        public static async Task PushMessageToEventHubsAsync(AttachmentMetaData msg, string eventHubConnectionString)
        {
            // Creates an EventHubsConnectionStringBuilder object from the connection string, and sets the EntityPath.
            // Typically, the connection string should have the entity path in it, but for the sake of this simple scenario
            // we are using the connection string from the namespace.
            var connectionStringBuilder = new EventHubsConnectionStringBuilder(eventHubConnectionString)
            {
                EntityPath = Constants.EVENT_HUB_NAME
            };

            eventHubClient = Microsoft.Azure.EventHubs.EventHubClient.CreateFromConnectionString(connectionStringBuilder.ToString());

            await  SendMessagesToEventHub(msg);

            await eventHubClient.CloseAsync();
        }
コード例 #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     eventHubClient.CloseAsync();
 }