Message exchange patterns defines the way client and wcf service exchange messages. There are mainly 3 type of message exchange patterns.
- This is default message exchange pattern
- Supported by all bindings except MSMQ binding
- in this pattern, the faults and exceptions get reported to the client immediately
- Client sends a message to wcf service and waits for a response.The client stops processing until a response is received
- IsOneWay parameter of operation contract attribute specifies the message exchange pattern
- if it is set to false or it is not mentioned, then the exchange pattern is request-reply pattern
One-way Message exchange pattern
Reference books, you may like:Programming WCF Services: Design and Build Maintainable Service-Oriented Systems
WCF Multi-Layer Services Development with Entity Framework, 4th Edition
Learning WCF: A Hands-on Guide
- The client makes a call to service operation and does not wait for service response
- To make an operation one-way, set IsOneWay to true.
- [Operation contract (IsOneWay=true)]
- Since this is one way, faults are not reported.
- you will get an exception, if operation is marked with IsOneWay=True declares an outut parameter or return value
- One Way call is not asynchronous call bcause when one way call is received at service and the service is busy serving other requests then the call gets queued.One way call can block the client if the no of message waiting to be processed exceeded the server queue limit.nOnly one message is exchanged between client and the service
Duplex Message exchange pattern
- This can be implemented using Request-Reply or One-way operations
- To implement Duplex message pattern using one way operation
- Remove service behavior attribute that sets ConcurrencyMode to Reentrant from wcf service
- Remove callbackBehavior attribute that sets UseSynchronizationContext to false in the client
- Set the operation contract to one way in service
© 2015, admin. All rights reserved.