Workflow and ServiceDesk Community

 View Only
Expand all | Collapse all

How can you construct timeouts in Workflow?

  • 1.  How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 05:02 AM

    Dear All,

    I have a Workflow Windows Service that seems to work for about 2 minutes (or about 12 email sends) and then stops running. It is hanging on executing the LogicBase.Components.Email.SendEmailComponentViaSMTP component.

    I think that I know the reason for this. The SMTP server at the other end might be keeping the component in a continuous wait for a response as a defensive mechanism. This is also probably reasonable, as my process seems to send a number of emails in a short time.

    So... the question has got to be, is there a way of watching a Component and then jumping to an exception if the component does not respond for a certain amount of time? I do not want the whole process to hang after justy 2 minutes of running happily.

    Kindest regards,

     

    QuietLeni



  • 2.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 08:47 AM

    If you are using a Workflow project, then where your SendEmailViaSMTP component is put that in to a "Dialog Workflow" model. Go on to the Event Configuration tab of the model and then set your timeout. You can then process your timeout this way and continue your process it just wont process the email. (it helps to put a log message into this also.

    Alternatively you could try the ExceptionByComponent Component and set this to the SendEmailViaSMTP but I'm not sure how this will work as the SendEmailViaSMTP component doesnt seem to have a configurable timeout period.



  • 3.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 08:55 AM

    Another way to go about this possibly would be to add a 'Pause Execution' component ahead of the SendEmail component. I'm assuming your SendEmail component is inside a loop so if you put the PauseExceuction component ahead of it and pause for say 10,000 milliseconds (10 secs), maybe that'll keep your SMTP server from going into defensive mode.



  • 4.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 10:26 AM

    Jesca,

    Thanks for the reply. The problem is that, as I said, this is a Windows Service Workflow. Sadly, this type of Project does not allow you to use Dialog Workflows. I like your thinking... ...is it possible to get Workflow split its execution, so that I could note the time at the beginning and then have a process waking up and checking on the result of a variable, then go to sleep, etc?

    QuietLeni



  • 5.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 10:31 AM

    You can have branching paths in Workflow. However, you can only have this in Workflow projects. You get branching paths by adding the Workflow.Advanced library in your project.



  • 6.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 10:32 AM

    matzebru,

    At the moment, my Windows Service runs every 30 seconds, using a schedule on the project. I have tried changing that to 2 minutes and it seems to get around the issue, just like yours does.

    However, this does not answer the question. My question is, is there a way of constructing a Timeout for the execution of the component and how do I do that? This is for other components without a timeout of their own. I want to make sure that my Windows Services do not hang or error in other cases.

    Thanks again,

    QuietLeni



  • 7.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 11:05 AM

    reecardo,

    Is there a technical or design reason for not allowing branched paths in Windows Service Workflow projects?



  • 8.  RE: How can you construct timeouts in Workflow?

    Posted Oct 27, 2011 04:04 PM

    If you really need to do this you might be able to get away with using a scripting component. It only takes a few lines of code to send an email.

    http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx

    There's a timeout property you can set:

    http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.timeout.aspx



  • 9.  RE: How can you construct timeouts in Workflow?

    Posted Oct 28, 2011 07:14 AM

    Although it doesn't help you now, a timeout property has been added to the Send Email via SMTP component yesterday. It'll appear in the next major release.



  • 10.  RE: How can you construct timeouts in Workflow?

    Posted Oct 28, 2011 07:48 AM

    reecardo,

    Thanks! Which major release will that be? The next Service Pack or 7.2 or 8.0 or what?



  • 11.  RE: How can you construct timeouts in Workflow?

    Posted Oct 28, 2011 07:56 AM

    8.0 (Workflow-cho). We're locked down for the next Service Pack.