Database Error message handling

Hi,

I have a scenario where i send a request to a client web service and receives response from the web service and successfully send the message to the client with success message written. Current scenario is web service returns message with status code 0 or 2 for success in which case we need to update the database and deliver the message to client if status code returned is 1 from the database then web service returns error message and exception is caught and the message is not delivered to the client instead just writes error message. 

but now the requirement is client want us to resend the error message in case of status code 1 even if its a error returned from web service. So my question is how to resend the messages in orchestration? I want to try  resending the message for certain time and then catch the exception as usual which is implemented in existing scenario. 

Also, i want to know if resending can be achieved by setting the retry count and Retry interval properties on send port? 

Is this something that makes sense? please urgent help needed. 


August 23rd, 2015 8:21am

Hi Lathaa,

So just to be clear your message exchange is succeeding but the inbound message from the web service has an internal status set to 1 which indicates failure?

So to say that another way, the web service call itself is not failing, just some of the logic in the service for dealing with the message from the orchestration?

If so, the Retry Count and Interval will not help you because the only place with knowledge that a failure has occurred is the orchestration to which the web service call is returned. 

In this case, the easiest thing to do would be to implement a Loop shape inside the orchestration and around the Send/Receive. This Loop could implement a counter and once that counter is reached an exception could be thrown (if necessary or just handled through a different branch of a Decide shape) and the processing of that condition handled through normal message flow.

Would that solve the problem?

Thanks,

Martin

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 2:00am

Hi Martin,

thanks for the reply. Yes I did think of having loop shape with retry count checked and the using send shape try to resend the original message back to another send port dynamically. If counter is reached then catch exception for which the logic is already implemented. I am not sure how exactly I can implement this as its first time im working with BizTalk. Any elaborating explanation would be of much help please

regards,

lathaa 

August 24th, 2015 5:00am

No, you can't use the the Retry options only in the port because technically, the service is not returning an error.  You're getting a code indicating non-success, but the service is completing normally.

You can use this pattern to handle the process in the Orchestration:

http://social.technet.microsoft.com/wiki/contents/articles/31665.biztalk-suspend-and-resume-an-orchestration-on-two-way-port-error.aspx

To accommodate the retry interval, you can test for code 1, then Throw a custom Exception.  Then in the Catch Block, use a Delay Shape instead of a Suspend Shape.

Now, you have both scenarios covered.

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 7:07am

Martin, thanks for the response. I went through the article, but my concern is that I do not want to suspend/resume orchestration but its just that I need to resend the messages that have received with status code 1 from DB. Its actually like below.

1. I receive an incoming message from another orchestration and receive port is directly bound to message box.

2.then we have a external web service which handles the received message by transforming into other messages and finally the message that is being handled by service is different from the original message and by this step we get message with status code as 1 which is treated as error message and an exception is caught and message is not sent back to service or customer.

3. So now customer wants us to resend the original message which we received from another orchestration initially back to them when status code of the message returned from web service is 1.

so this I am trying to achieve. existing is we have decision that checks for status code as 0 1 2, if status code is 0 r 2 then the message is successful and sent back to customer an update to db is carried out. on Else branch we are just caching the system exception and writing the error message and message is not sent back. Instead of catching an exception initially we need to just resend the original message for certain time and then try catching an exception. So I thought to use loop shape inside which have a delay and send shape o send back message. is this something doable? or can you just tell me interms of what shapes can be used and achieve this scenario?

 

August 24th, 2015 7:38am

So in case of 1, you need to send the original message, not the transformed one that caused the 1 response.

Ok, I don't really see the complication.  If you receive 1, just sent the original message through the same port.

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 11:01am

Hi Lathaa,

I think you've got the right solution, so when 1 retry a number of times and add Delay if necessary but I think you also need to understand what is causing the failure.

If the service will ALWAYS give an output of 1 for the given message, at some point you need to move that message somewhere else for investigation. 

Like all things here, what you could do is have a property schema that contains the error code and any information (have these use MessageContextPropertyBase), set these in any exit process from your loop, promote the properties in a Correlation Set and then direct the output back to the MsgBox via a Direct Bound port.

See the following article which describes this.

https://masteringbiztalkserver.wordpress.com/2011/03/08/difference-between-messagecontextpropertybase-and-messagedatapropertybase/


You could then have a Send Port that subscribes to these messages.

You would also need some kind of alerting mechanism so you can start investigation. 

Once the message is fixed, you just need a mechanism to resubmit, so file drop is probably easiest there if your Orchestration is already directly bound to the MsgBox like you say.

Cheers,

Martin

August 24th, 2015 8:48pm

Hi Lathaa,

I think you've got the right solution, so when 1 retry a number of times and add Delay if necessary but I think you also need to understand what is causing the failure.

If the service will ALWAYS give an output of 1 for the given message, at some point you need to move that message somewhere else for investigation. 

Like all things here, what you could do is have a property schema that contains the error code and any information (have these use MessageContextPropertyBase), set these in any exit process from your loop, promote the properties in a Correlation Set and then direct the output back to the MsgBox via a Direct Bound port.

See the following article which describes this.

https://masteringbiztalkserver.wordpress.com/2011/03/08/difference-between-messagecontextpropertybase-and-messagedatapropertybase/


You could then have a Send Port that subscribes to these messages.

You would also need some kind of alerting mechanism so you can start investigation. 

Once the message is fixed, you just need a mechanism to resubmit, so file drop is probably easiest there if your Orchestration is already directly bound to the MsgBox like you say.

Cheers,

Martin

  • Marked as answer by Lathaa 22 hours 24 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 12:47am

Hi Lathaa,

I think you've got the right solution, so when 1 retry a number of times and add Delay if necessary but I think you also need to understand what is causing the failure.

If the service will ALWAYS give an output of 1 for the given message, at some point you need to move that message somewhere else for investigation. 

Like all things here, what you could do is have a property schema that contains the error code and any information (have these use MessageContextPropertyBase), set these in any exit process from your loop, promote the properties in a Correlation Set and then direct the output back to the MsgBox via a Direct Bound port.

See the following article which describes this.

https://masteringbiztalkserver.wordpress.com/2011/03/08/difference-between-messagecontextpropertybase-and-messagedatapropertybase/


You could then have a Send Port that subscribes to these messages.

You would also need some kind of alerting mechanism so you can start investigation. 

Once the message is fixed, you just need a mechanism to resubmit, so file drop is probably easiest there if your Orchestration is already directly bound to the MsgBox like you say.

Cheers,

Martin

  • Marked as answer by Lathaa Thursday, August 27, 2015 8:39 AM
August 25th, 2015 12:47am

Hi Lathaa,

I think you've got the right solution, so when 1 retry a number of times and add Delay if necessary but I think you also need to understand what is causing the failure.

If the service will ALWAYS give an output of 1 for the given message, at some point you need to move that message somewhere else for investigation. 

Like all things here, what you could do is have a property schema that contains the error code and any information (have these use MessageContextPropertyBase), set these in any exit process from your loop, promote the properties in a Correlation Set and then direct the output back to the MsgBox via a Direct Bound port.

See the following article which describes this.

https://masteringbiztalkserver.wordpress.com/2011/03/08/difference-between-messagecontextpropertybase-and-messagedatapropertybase/


You could then have a Send Port that subscribes to these messages.

You would also need some kind of alerting mechanism so you can start investigation. 

Once the message is fixed, you just need a mechanism to resubmit, so file drop is probably easiest there if your Orchestration is already directly bound to the MsgBox like you say.

Cheers,

Martin

  • Marked as answer by Lathaa Thursday, August 27, 2015 8:39 AM
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 12:47am

hi martin, thanks much for your response. Just to let you know, we need not investigate or fix the error file having status code as 1 which we receive from web service as we do not have access to that web service. we just need to resend the original file back to customer unless they receive it. So I am doing below steps.

1. Checking if status code is 0 or 2 , if so continue with existing functionality. Else which means status code is 1 then inserting a loop shape and checking the loopcounter variable to loop for 5times.then have scope shape inside which will have below functionality. 

2. Insert a delay shape to wait for 15mins

3.insert receive shape to receive the original message from the original Receive port. Here receive port is direct bound and filter expressions are set in the receive shape to receive incoming file. So now if I have to send back original file then I need to receive the message again ? if so I get error saying  "you must specify at least one already-initialized correlation set for a non-activation receive that is on a non-selfcorrelating port" .  so I made the original receive port as self correlating direct bound port to get rid of this error. but if I do so will the filter expressions still work on the receive shape to receive the incoming message? or not? please let me know.

4.Inserting a send shape to send back the original file to new send port which I am making as direct bound self correlating port assuming the file gets back to database.

5.expression shape to increment the loop counter unless to try resending the file back. once the loopcounter attains max number exits loop and system exception is caught.

Is this the right way I am doing? and do I need to construct the message? or current scenario should work fine? please advise.

August 25th, 2015 7:28am

Hi,

Since your process is running you already have the original message with you. Why you want to receive the message again by adding the receive shape. Just send the message you recevied orginally again to the send port.

Rahul

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 7:59am

Hi Rahul, thanks for reply. I am trying to receive again because in between there are many transformations happening and finally when the response message received from web service with status code 1 I need resend the original message. I am not sure if till here the original message exists? if so then I can only send back. can you confirm please? thanks.  
August 25th, 2015 8:34am

Hi Rahul,

Thanks. I have implemented scenario hoping to get this worked. Thanks again for your help.

  • Marked as answer by Lathaa 22 hours 24 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 4:42am

Hi Rahul,

Thanks. I have implemented scenario hoping to get this worked. Thanks again for your help.

  • Marked as answer by Lathaa Thursday, August 27, 2015 8:39 AM
August 27th, 2015 8:39am

Hi Rahul,

Thanks. I have implemented scenario hoping to get this worked. Thanks again for your help.

  • Marked as answer by Lathaa Thursday, August 27, 2015 8:39 AM
Free Windows Admin Tool Kit Click here and download it now
August 27th, 2015 8:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics