This post is continuation of post Concurrency Mode in WCF. Please visit following link before reading this post.
http://logicsmaze.blogspot.in/2015/06/concurrency-mode-in-wcf.html
The Reentrant concurency mode is nothing but a modified version of a single concurrency mode.Similar to single concurrency, reentrant concurrency exclusively lock the service instance so that a concurrent call on the same instance is never called.
But apart from that, Reentrant concurrency mode allows the service to issue callbacks to the client.And this call back can be two way and re-entrant calls can be accepted by service instance.
If we implement call back scenario, set Concurrency mode Single, as we run client we will get error because call back will be two way and service reference will not serve re-entrant call.
If we set Concurrency mode Single and set IsOneWay = true within [OperationContract], in this scenario call back request go to the client but client can't send call back response to service, so everything will work fine.
[ServiceContract]
public interface IReportProgressCallback
{
[OperationContract(IsOneWay=true)]
void ReportProgress(int percentage);
}
If we want to use two way callback than we need to set concurrency mode reentrant.
For detailed description about other concurrency mode please visit following posts.
Single-concurrency-mode-in-wcf
Multiple-concurrency-mode-in-wcf
Reentrant-concurrency-mode-in-wcf
http://logicsmaze.blogspot.in/2015/06/concurrency-mode-in-wcf.html
The Reentrant concurency mode is nothing but a modified version of a single concurrency mode.Similar to single concurrency, reentrant concurrency exclusively lock the service instance so that a concurrent call on the same instance is never called.
But apart from that, Reentrant concurrency mode allows the service to issue callbacks to the client.And this call back can be two way and re-entrant calls can be accepted by service instance.
If we implement call back scenario, set Concurrency mode Single, as we run client we will get error because call back will be two way and service reference will not serve re-entrant call.
If we set Concurrency mode Single and set IsOneWay = true within [OperationContract], in this scenario call back request go to the client but client can't send call back response to service, so everything will work fine.
[ServiceContract]
public interface IReportProgressCallback
{
[OperationContract(IsOneWay=true)]
void ReportProgress(int percentage);
}
If we want to use two way callback than we need to set concurrency mode reentrant.
For detailed description about other concurrency mode please visit following posts.
Single-concurrency-mode-in-wcf
Multiple-concurrency-mode-in-wcf
Reentrant-concurrency-mode-in-wcf
Thanks :-)
Related Post :
Message-exchange-pattern-in-wcf
Different-option-of-hosting-wcf-service
Binding-in-wcf-choosing-right-wcf-service
Hosting WCF with Non-Http protocol
Exchanging-metadata-in-wcf
Some-interesting-facts-about-data-contract
Knowntype-attribute-in-wcf
Associating-knowntype-in-wcf
Message-contract-in-wcf
Exception-handling-in-wcf
()- Exception Handling in WCF - SOAP Fault in WCF
()- Exception Handling in WCF - Unhandled Exception in WCF
()- Exception Handling in WCF - Creating and Throwing Strongly Typed SOAP FaultInstance-context-mode-in-wcf
()- PerCall-instance-context-mode-in-wcf
Message-exchange-pattern-in-wcf
Different-option-of-hosting-wcf-service
Binding-in-wcf-choosing-right-wcf-service
Hosting WCF with Non-Http protocol
Exchanging-metadata-in-wcf
Some-interesting-facts-about-data-contract
Knowntype-attribute-in-wcf
Associating-knowntype-in-wcf
Message-contract-in-wcf
Exception-handling-in-wcf
()- Exception Handling in WCF - SOAP Fault in WCF
()- Exception Handling in WCF - Unhandled Exception in WCF
()- Exception Handling in WCF - Creating and Throwing Strongly Typed SOAP FaultInstance-context-mode-in-wcf
()- PerCall-instance-context-mode-in-wcf

No comments:
Post a Comment