コード例 #1
0
        public static async void PublishTopic(QueryEvent qe)
        {
            const string ServiceBusConnectionString = "Endpoint=sb://cloud2fidosb.servicebus.windows.net/;SharedAccessKeyName=TheWriter;SharedAccessKey=0c3IeFz15pod35soz15yzBVtyj/Pyxx856Q3ty82ufA=";
            const string TopicName = "cloud2fidotopic";

            ITopicClient topicClient = new TopicClient(ServiceBusConnectionString, TopicName);

            var message = new Message(Encoding.UTF8.GetBytes(RegisterQuery.ToJSON <QueryEvent>(qe)));
            await topicClient.SendAsync(message);

            await topicClient.CloseAsync();
        }