views:

1204

answers:

4

Hi,

I have a client application that once in while notifies about its progress a service. The method call to the service is marked with IsOneWay=true, because the notification doesn't need any return value and I don't want to delay.

The client may notify about errors to the service, and afterward it terminates.

The question is: does a oneway method call returns to the caller code after it sent the message? or it queues the message and later on it is sent by another thread?

The two processes (the client and the service) are on the same machine, and I noticed that sometimes (when the machine is overloaded) the service doesn't get the error notification. I suspect that the second option I mentioned happens, but I am not sure.

If I am right, how can I make sure the notification is send and keep the method oneway?

Ami

A: 

You can't "make sure the notification is sent" ... and "keep the method oneway". That kinda goes against what "OneWay" means :)

If you want to ensure that the message is sent, it's ok to do TwoWay. You most likely won't notice the slight performance hit. And if the server and client are on the same machine as you mentioned... then you will not notice the performance hit at all.

Timothy Khouri
I know that I can't make sure that the method will be called at the service (received) and that is ok. Because it's on the same machine I believe it is reliable enough to alway be received.However, how can I make sure the client sends the method call message? and also keep the method oneway?
A: 

Check out this post for some detailed info: http://kennyw.com/indigo/130

Also, I believe that if you have reliable messaging enabled that the request would be verified as sent successfully, but as the above post notes, the service will end the connection after that point.

MattK
A: 

I agree with Timothy. I also want to add that the WCF service keeps a queue for incoming messages. That queue may become full if the service isn't able to process messages as fast as they are coming in. When the incoming queue becomes full, WCF will drop new messages.

I'm not sure what happens on the client side if one-way messages are dropped though. I assume that no exception/fault is thrown but I don't know that for sure.

Karl
+1  A: 

This might be a good place to use a netMsmqBinding. All MSMQ messages are inherently OneWay because queues are inherently disconnected. Once the client queues the message with a netMsmq client, it can safely shutdown, and the server can later pickup the message and process it.

Andy White