Thursday, November 17, 2016

How to get Retry Count of Successful sent attempt -Two way Scenario

In the last post we saw how to get retry count of successful attempt of transmission in one way scenario, there we used Delivery Notification property of logical send port where NACK actually generates Delivery Failure exception, but that property doesn't work with web service call i.e. request- response port.

Why?

In case of two way port the "Delivery Notification" is implicit in the Receive Operation, so either you receive a service response message or an error message thus completing the call i.e. confirming Delivery. 

But what if the service you are calling is stopped or unavailable temporarily? Do we get Delivery Failure exception? 

To demonstrate what exception we get and how to get Retry count of the successful attempt in case of webservice call, have created very simple WCF Service with four methods and deployed it on the same machine, followed by consuming it using BizTalk WCF consuming Wizard.

WCF service code



published webservicebrowsing the service








How to do 



Scenario:


The scenario is simple, you have to invoke a Add method of HelloWordWCFservice and if there is failure then retry has to be done and log the retrycount when service call was successful.




Input schema 

input schema

Output schema and generated files by wizard

artifacts generated by Consuming wizard

Creating Orchestration


Orchestration with retry logic

The steps remain same as demonstrated in earlier post,the change here is we have request-response port, one send port where the response message from service call and have included following exception blocks 

exception blocks


Here if you see, I have placed the exception blocks based on relevance, of most likely exception to be raised.

Testing



1. Service is up and running


In this scenario, the call was successful and the response message was saved at the configured folder.


event log for successful transmission

2. Service is stopped with Retry count set to 3 and retry interval set to 1 minute (Service started after 1 minute)


event log for exception caught

As can be seen above the type of exception raised was Soap Exception when the service was stopped and we get the RetryCount of the successful attempt i.e. 1 when service started.

Note: The Delivery Notification property(either None or Transmitted) has no effect on the behavior


Download Sample



No comments:

Post a Comment