Service Bus
Queue
- QueueDescription
- Session
- Duplicate Message Detect
- Transaction
- Defer Message
- Delete Letter Queue
Sender:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Specialized;
using System.Data.Services.Client;
using System.Threading;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Transactions;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
string queuename = "newqueue";
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
MessagingFactory factory = null;
/***********************NameSpace*****************************************/
NamespaceManager namespaceClient = new NamespaceManager(serviceUri, credentials);
if (namespaceClient == null)
{
Console.WriteLine("\nUnexpected Error: NamespaceManager is NULL");
return;
}
// Configure Queue Settings
QueueDescription queueDescription = new QueueDescription(queuename);
//queueDescription.RequiresSession = true;
queueDescription.RequiresDuplicateDetection = true;//duplicate messages are detected and dropped by the queue itself
// Delete if exists
if (namespaceClient.QueueExists(queueDescription.Path))
{
//namespaceClient.DeleteQueue(queuename);
Console.WriteLine("\nQueue is existing");
}
else
{
namespaceClient.CreateQueue(queueDescription);
}
/***********************QueueClient*****************************************/
factory = MessagingFactory.Create(serviceUri, credentials);
QueueClient myQueueClient = factory.CreateQueueClient(queuename);
//1.....................Send Normal Message
//BrokeredMessage message = new BrokeredMessage("issueBody");
//myQueueClient.Send(message);
//Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
//2......................Send Session Message
//BrokeredMessage sessionmessage = new BrokeredMessage("session 1 issue Body");
//sessionmessage.SessionId = "1";
//myQueueClient.Send(sessionmessage);
//Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", sessionmessage.MessageId, sessionmessage.GetBody<string>()));
//BrokeredMessage sessionmessage2 = new BrokeredMessage("session 2 issue Body");
//sessionmessage2.SessionId = "2";
//myQueueClient.Send(sessionmessage2);
//Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", sessionmessage2.MessageId, sessionmessage2.GetBody<string>()));
//3......................Send duplicate message
//BrokeredMessage message = new BrokeredMessage("issueBody");
//message.MessageId = "123";
//myQueueClient.Send(message);
//BrokeredMessage message2 = new BrokeredMessage("issueBody");
//message2.MessageId = "123";
//myQueueClient.Send(message2);
//BrokeredMessage message3 = new BrokeredMessage("issueBody");
//message3.MessageId = "123";
//myQueueClient.Send(message3);
//4........................Defer Message Sample
//BrokeredMessage message = new BrokeredMessage("issueBody");
//message.MessageId = "123";
//myQueueClient.Send(message);
//BrokeredMessage message2 = new BrokeredMessage("issueBody");
//message2.MessageId = "456";
//myQueueClient.Send(message2);
//Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
//5.........................Transaction
//using (TransactionScope scope = new TransactionScope())
//{
// //Scenarios: Only when recieve a message and process then send a new message
// // This call to Send(BrokeredMessage) takes part in the local transaction and will
// // not persist until the transaction Commits; if the transaction is not committed,
// // the operation will Rollback
// //sender.Send(replyMessage);
// // This call to Complete() also takes part in the local transaction and will not
// // persist until the transaction Commits; if the transaction is not committed, the
// // operation will Rollback
// //receivedMessage.Complete();
//}
//6.................Log the dead-lettered messages that could not be processed
BrokeredMessage message = new BrokeredMessage("issueBody");
message.MessageId = "123";
myQueueClient.Send(message);
Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Receiver:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
namespace Receiver
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
string queuename = "newqueue";
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
MessagingFactory factory = null;
/***********************NameSpace*****************************************/
NamespaceManager namespaceClient = new NamespaceManager(serviceUri, credentials);
if (namespaceClient == null)
{
Console.WriteLine("\nUnexpected Error: NamespaceManager is NULL");
return;
}
QueueDescription queueDescription = namespaceClient.GetQueue(queuename);
if (queueDescription == null)
{
Console.WriteLine("\nUnexpected Error: QueueDescription is NULL");
return;
}
/***********************QueueClient*****************************************/
factory = MessagingFactory.Create(serviceUri, credentials);
QueueClient myQueueClient = factory.CreateQueueClient(queuename,ReceiveMode.PeekLock);
long messageCount = queueDescription.MessageCount;
//1.......................Receive All Message
//BrokeredMessage message;
//for (long count = 0; count < messageCount; count++)
//{
// message = myQueueClient.Receive(TimeSpan.FromSeconds(5));
// if (message != null)
// {
// Console.WriteLine(string.Format("Message received: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
// // Further custom message processing could go here...
// message.Complete();
// }
// else
// {
// Console.WriteLine("Unexpected Error, Did not receive the messages");
// }
//}
//2.........................Receive only Session Message - only receive session id="1"
//MessageSession sessionReceiver = myQueueClient.AcceptMessageSession("1",TimeSpan.FromSeconds(60));
//Console.WriteLine("sessionReceiver Session ID:" + sessionReceiver.SessionId);
//BrokeredMessage receivedMessage;
//while ((receivedMessage = sessionReceiver.Receive(TimeSpan.FromSeconds(15))) != null)
//{
// string sessionId = sessionReceiver.SessionId;
// receivedMessage.Complete();
// Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}, SessionId={2}",
// receivedMessage.MessageId,
// receivedMessage.GetBody<string>(),
// receivedMessage.SessionId));
//}
//3......................Duplicate Message detect
//string receivedMessageId = "";
//while (true)
//{
// BrokeredMessage receiveMessage = myQueueClient.Receive(TimeSpan.FromSeconds(10));
// if (receiveMessage == null)
// {
// break;
// }
// else
// {
// Console.WriteLine("\t<= Received a message with messageId {0}", receiveMessage.MessageId);
// receiveMessage.Complete();
// if (receivedMessageId.Equals(receiveMessage.MessageId, StringComparison.OrdinalIgnoreCase))
// {
// Console.WriteLine("\t\tRECEIVED a DUPLICATE MESSAGE");
// }
// receivedMessageId = receiveMessage.MessageId;
// }
//}
//4...................Defer Message
//long deferMessageSequenceNumber=0;
//while (true)
//{
// BrokeredMessage receiveMessage = myQueueClient.Receive(TimeSpan.FromSeconds(10));
// if (receiveMessage == null)
// {
// break;
// }
// else
// {
// if (receiveMessage.MessageId.Equals("123"))
// {
// receiveMessage.Defer();
// deferMessageSequenceNumber = receiveMessage.SequenceNumber;
// }
// else
// {
// Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", receiveMessage.MessageId, receiveMessage.GetBody<string>()));
// }
// }
//}
//BrokeredMessage deferMessage = myQueueClient.Receive(deferMessageSequenceNumber);
//Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", deferMessage.MessageId, deferMessage.GetBody<string>()));
//5.........................Transaction(Ignore)
//6.........................Log the dead-lettered messages that could not be processed
BrokeredMessage receiveMessage = myQueueClient.Receive(TimeSpan.FromSeconds(10));
receiveMessage.DeadLetter("UnableToProcess", "Failed to process in reasonable attempts");
QueueClient deadLetterClient = factory.CreateQueueClient(QueueClient.FormatDeadLetterPath(myQueueClient.Path),
ReceiveMode.ReceiveAndDelete);
BrokeredMessage receivedDeadLetterMessage;
while ((receivedDeadLetterMessage = deadLetterClient.Receive(TimeSpan.FromSeconds(10))) != null)
{
Console.WriteLine(string.Format("Message sent: Id = {0}, Body = {1}", receivedDeadLetterMessage.MessageId, receivedDeadLetterMessage.GetBody<string>()));
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Topic
- Routing, subscriber to different subscription
- Filter, filter message by property
Sender
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Specialized;
using System.Data.Services.Client;
using System.Threading;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Transactions;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
/***********************NameSpace*****************************************/
NamespaceManager namespaceClient = new NamespaceManager(serviceUri, credentials);
if (namespaceClient == null)
{
Console.WriteLine("\nUnexpected Error: NamespaceManager is NULL");
return;
}
TopicDescription myTopic=null;
SubscriptionDescription myAuditSubscription = null;
SubscriptionDescription myAgentSubscription = null;
SubscriptionDescription myFilterSubscription = null;
if (!namespaceClient.TopicExists("IssueTrackingTopic"))
{
myTopic = namespaceClient.CreateTopic("IssueTrackingTopic");
}
else
{
myTopic = namespaceClient.GetTopic("IssueTrackingTopic");
}
if (!namespaceClient.SubscriptionExists("IssueTrackingTopic", "AuditSubscription"))
{
myAuditSubscription = namespaceClient.CreateSubscription(myTopic.Path,
"AuditSubscription");
}
else
{
myAuditSubscription = namespaceClient.GetSubscription(myTopic.Path,
"AuditSubscription");
}
if (!namespaceClient.SubscriptionExists("IssueTrackingTopic", "AgentSubscription"))
{
myAgentSubscription = namespaceClient.CreateSubscription(myTopic.Path,
"AgentSubscription");
}
else
{
myAgentSubscription = namespaceClient.GetSubscription(myTopic.Path,
"AgentSubscription");
}
if (!namespaceClient.SubscriptionExists("IssueTrackingTopic", "FilterSubscription"))
{
myFilterSubscription = namespaceClient.CreateSubscription(myTopic.Path,
"FilterSubscription", new SqlFilter("color = 'blue' AND quantity = 10"));
}
else
{
myFilterSubscription = namespaceClient.GetSubscription(myTopic.Path,
"FilterSubscription");
}
MessagingFactory factory = MessagingFactory.Create(serviceUri, credentials);
TopicClient myTopicClient = factory.CreateTopicClient(myTopic.Path);
BrokeredMessage message = new BrokeredMessage("messageissue");
myTopicClient.Send(message);
Console.WriteLine(
string.Format("Message sent: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
BrokeredMessage message2 = new BrokeredMessage("messageissue2");
myTopicClient.Send(message2);
Console.WriteLine(
string.Format("Message sent: Id = {0}, Body = {1}", message2.MessageId, message2.GetBody<string>()));
BrokeredMessage message3 = new BrokeredMessage("message3");
message3.CorrelationId = "high";
message3.Properties.Add("color", "blue");
message3.Properties.Add("quantity", 10);
myTopicClient.Send(message3);
Console.WriteLine(
string.Format("Message sent: Id = {0}, Body = {1}", message3.MessageId, message3.GetBody<string>()));
BrokeredMessage message4 = new BrokeredMessage("message4");
message4.CorrelationId = "low";
message4.Properties.Add("color", "white");
message4.Properties.Add("quantity", "10");
myTopicClient.Send(message4);
Console.WriteLine(
string.Format("Message sent: Id = {0}, Body = {1}", message4.MessageId, message4.GetBody<string>()));
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Receiver
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
namespace Receiver
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
/***********************NameSpace*****************************************/
NamespaceManager namespaceClient = new NamespaceManager(serviceUri, credentials);
if (namespaceClient == null)
{
Console.WriteLine("\nUnexpected Error: NamespaceManager is NULL");
return;
}
MessagingFactory factory = MessagingFactory.Create(serviceUri, credentials);
//1...............................Routing
SubscriptionClient agentSubscriptionClient = factory.CreateSubscriptionClient("IssueTrackingTopic",
"AgentSubscription", ReceiveMode.PeekLock);
SubscriptionClient auditSubscriptionClient = factory.CreateSubscriptionClient("IssueTrackingTopic",
"AuditSubscription", ReceiveMode.ReceiveAndDelete);
BrokeredMessage message;
while ((message = agentSubscriptionClient.Receive(TimeSpan.FromSeconds(5))) != null)
{
Console.WriteLine("\nReceiving message from AgentSubscription...");
Console.WriteLine(string.Format("Message received: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
// Further custom message processing could go here...
message.Complete();
}
// Create a receiver using ReceiveAndDelete mode
while ((message = auditSubscriptionClient.Receive(TimeSpan.FromSeconds(5))) != null)
{
Console.WriteLine("\nReceiving message from AuditSubscription...");
Console.WriteLine(string.Format("Message received: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
// Further custom message processing could go here...
}
//2..............................Filter
SubscriptionClient filterSubscriptionClient = factory.CreateSubscriptionClient("IssueTrackingTopic",
"FilterSubscription", ReceiveMode.ReceiveAndDelete);
// Create a receiver using ReceiveAndDelete mode
while ((message = filterSubscriptionClient.Receive(TimeSpan.FromSeconds(5))) != null)
{
Console.WriteLine("\nReceiving message from filterSubscription...");
Console.WriteLine(string.Format("Filtered Message received: Id = {0}, Body = {1}", message.MessageId, message.GetBody<string>()));
// Further custom message processing could go here...
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Relay Service
Server
Note: when ServiceRegistrySettings is public discovery, you will able to see the feed "Temperature Service" in the
https://youaretheone.servicebus.windows.net/
![](http://hi.csdn.net/attachment/201201/31/10223170_1328024904Uryd.png)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Specialized;
using System.Data.Services.Client;
using System.Threading;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Transactions;
using System.ServiceModel;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Console.WriteLine("Server");
ServiceRegistrySettings registryBehavior =
new ServiceRegistrySettings()
{
DiscoveryMode = DiscoveryType.Public,
DisplayName = "Temperature Service"
};
TransportClientEndpointBehavior credentialBehavior = new TransportClientEndpointBehavior();
credentialBehavior.TokenProvider = credentials;
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
using (ServiceHost serviceHost = new ServiceHost(typeof(TemperatureService), serviceUri))
{
NetTcpRelayBinding binding = new NetTcpRelayBinding();
serviceHost.AddServiceEndpoint(typeof(ITemperatureContract), binding, serviceUri);
serviceHost.Description.Endpoints[0].Behaviors.Add(
credentialBehavior);
serviceHost.Description.Endpoints[0].Behaviors.Add(
registryBehavior);
serviceHost.Open();
Console.WriteLine("Press Enter to exit.");
Console.ReadLine();
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Client:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.ServiceModel;
using AzureTest;
namespace Receiver
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, string.Empty);
Console.WriteLine("Client");
TransportClientEndpointBehavior credentialBehavior =new TransportClientEndpointBehavior();
credentialBehavior.TokenProvider = credentials;
NetTcpRelayBinding binding = new NetTcpRelayBinding();
EndpointAddress endpointAddress = new EndpointAddress(serviceUri);
using (ChannelFactory<ITemperatureContract> channelFactory = new ChannelFactory<ITemperatureContract>(
binding, endpointAddress))
{
channelFactory.Endpoint.Behaviors.Add(credentialBehavior);
ITemperatureContract channel =channelFactory.CreateChannel();
((ICommunicationObject)channel).Open();
Double boilingPointCelsius = channel.ToCelsius(212);
Double boilingPointFahrenheit =
channel.ToFahrenheit(boilingPointCelsius);
Console.WriteLine("212 Fahrenheit is {0} celsius",
boilingPointCelsius);
Console.WriteLine("{0} celsius is {1} Fahrenheit",
boilingPointCelsius, boilingPointFahrenheit);
((ICommunicationObject)channel).Close();
Console.WriteLine("Press Enter to exit.");
Console.ReadLine();
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Publisher - Subscriber : netEventRelayBinding (Oneway)
- Subscriber: ALL WCF Services
Subscriber:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Specialized;
using System.Data.Services.Client;
using System.Threading;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Transactions;
using System.ServiceModel;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
string servicename = "AzureTest.TemperatureService";
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Console.WriteLine("Subscriber");
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, servicename);
TransportClientEndpointBehavior credentialBehavior = new TransportClientEndpointBehavior();
credentialBehavior.TokenProvider = credentials;
using (ServiceHost serviceHost = new ServiceHost(typeof(TemperatureService), serviceUri))
{
serviceHost.Description.Endpoints[0].Behaviors.Add(credentialBehavior);
serviceHost.Open();
Console.WriteLine("Press Enter to Exit");
Console.ReadLine();
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Subscriber Configuration
<system.serviceModel>
<services>
<service name="AzureTest.TemperatureService">
<endpoint
name="RelayEndpoint"
binding="netEventRelayBinding"
contract="AzureTest.ITemperatureContract"/>
</service>
</services>
Publisher:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.ServiceModel;
using AzureTest;
namespace Receiver
{
class Program
{
static void Main(string[] args)
{
string issuename = System.Configuration.ConfigurationManager.AppSettings["servicebusissuename"];
string issuekey = System.Configuration.ConfigurationManager.AppSettings["servicebusissuekey"];
string servicenamespace = System.Configuration.ConfigurationManager.AppSettings["servicebusnamespace"];
string servicename = "AzureTest.TemperatureService";
//Token
TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(issuename,
issuekey);
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb", servicenamespace, servicename);
Console.WriteLine("Publisher");
TransportClientEndpointBehavior credentialBehavior =new TransportClientEndpointBehavior();
credentialBehavior.TokenProvider = credentials;
EndpointAddress endpointAddress = new EndpointAddress(serviceUri);
using (ChannelFactory<ITemperatureContract> channelFactory = new ChannelFactory<ITemperatureContract>(
"RelayEndpoint"))
{
channelFactory.Endpoint.Behaviors.Add(credentialBehavior);
ITemperatureContract channel =channelFactory.CreateChannel();
((ICommunicationObject)channel).Open();
channel.ToCelsius(212);
channel.ToFahrenheit(212);
((ICommunicationObject)channel).Close();
Console.WriteLine("Press Enter to exit.");
Console.ReadLine();
}
Console.WriteLine("End");
Console.ReadKey();
}
}
}
Publisher Configuration
<system.serviceModel>
<client>
<endpoint name="RelayEndpoint"
address="sb://youaretheone.servicebus.windows.net/AzureTest.TemperatureService"
binding="netEventRelayBinding"
contract="AzureTest.ITemperatureContract"/>
</client>