Messaging patterns In WCF

Messaging Patterns describes that how program exchange messages.
 
For Example: If a wants to send a message to B, in this case A need to confirm the best way to communicate with B.In the same way, B also wants to know the same.

There are three basic Messaging patterns that programs can use to exchange messages.

  1. Simple
  2. Duplex
  3. Request-Reply
Simplex: This is the simple one-way communication. Like, if we want to send a message to the service and we are not interested in recieveing anything from the service side. It is declared by setting the IsOneWay property in the OperationContractAttribute to True.

[ServiceContract()]
public intrerface IStudentsService
{
[o
perationContract(IsOneWay=true)]
void findstu(int rn);
}

Duplex: This is a Two-Way Communication Process. In which, a consumer send a message to the service and the service sends a notification that the request processing has been done. It is just like that we send some command about the printing of some papers to the Printer machine. The printer machine start communication by making the connection with our machine, and start printing the paper.

Request-Reply: In this case the client sends a response and then waits for the reply. The Service doesn't communicate until it receive the messages from the client side. It is not just like the duplex system, where we use the two way communication. As if we don't set the IsOneWay property OperationContractAttribute is set to true and if we are not in a Duplex channel setting we can use this.
 
[ServiceContract()]
public intrerface IStudentsService
{
[OperationContract()]
StudentAssignmentsCheck SubmitAssignment (AssginmentNo, Assignmentno);
[OperationContract()]
v
oid findstu(int rn);
}