Alexandru
Alexandru

Reputation: 12912

Can you ensure delivery with one-way service methods?

Say I have a proxy that sends a message to a WCF server:

NetNamedPipeBinding b = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
b.MaxConnections = 1000000;
EndpointAddress address = new EndpointAddress(@"net.pipe://sendmessage");
channelFactory = new ChannelFactory<ISendMessage>(b, address);
proxy = channelFactory.CreateChannel();
proxy.SendMessage("Hello, world.");

Say the SendMessage function has a one-way OperationContract:

[OperationContract(IsOneWay=true)]
void SendMessage(string message);

Does running the line of code, proxy.SendMessage("Hello, world."); guarantee delivery of the message to the server? If not by default, is there a way to guarantee delivery? Say my application crashes, and it crashes right after proxy.SendMessage("Hello, world."); runs, will the message have made it to the server assuming no network glitches?

Upvotes: 2

Views: 217

Answers (1)

Den Pakizh
Den Pakizh

Reputation: 384

One-way operation ensures that your request is queued on service side. The main difference from request-reply operation is that client unblocks immediately after the server got the message without waiting for operation dispatching. Therefore, there is no way to know operation result, exceptions thrown or even the fact that operation was invoked.

You can read details here http://msdn.microsoft.com/en-us/magazine/cc163537.aspx#S1

Upvotes: 1

Related Questions