index > Windows Workflow Foundation > Design questions for payment system (timer)

Design questions for payment system (timer)

Hi,

I'm new to workflow and currently is trying to evaluate our payment system by utilizing this new technology. I have the following question and would appreciate any links, comments, or hints.

Our application is a asp.net web application, where user can submite their donations. There are many possible scenarios. One of them is: user do their first payment right away and then schedule future payments, for example, charge their credit card every first day of the month. The steps are as follows:

  • There is a asp.net website where donations are made.
  • After the donation is submitted, the workflow starts.
  • Inside the workflow, we create invoice, charge credit card/check/direct deposit, send thank you email, and etc.
  • On the first day of next month, a "timer" or "scheduler" component will raise an event to the workflow and collect money.
  • Future payments will be repeated by the scheduler until the end date given by user and a cancel action.

My question is: how to implement this timer/scheduler component? Do I use windows service as the scheduler to host the workflow runtime and run the workflow? Is there any other way to do it?

Thanks~

Chia Wang

the simplest design would be a while loop that starts with the payment and ends with a delay (thus your first payment would get invoked on the first iteration). The condition on the while would stop your payments all together (i.e. this when the payments are done for the user).

If you use the delay, then you don't need to do anything external to the workflow runtime, you just need to make sure the host application is up and running with the runtime created so that the timers correctly expire/fire.

Matt




See What You Can Learn -- http://www.pluralsight.com/courses/IntroducingWF.aspx
Matt Milner - Pluralsight

Hi Matt,

Let's say I have a windows service up running as the workflow runtime host; whenever I receive a request from client (web server), I start a workflow instance, which contains a while loop with a delay like you mention above. If the TimeoutDuration set for the delay is next month, does that mean this workflow instance is sitting there waiting until next month? What if I have thousands of donors want to make donations at the same time, do thousands of workflow instances get created as well? How does this affect the performance of this kind of transaction system?

Thanks,
Chia

Chia Wang
Once the workflow instance hits the Delay activity, it will go idle, which will cause the workflow to persist itseld via the persistence service you have attached to the runtime (assume you attach one). At this point, the instance is not in memory and will be loaded back into memory when the persistence service recognizes the Delay activity is finishing (the "wake-up" time is persisted and the service polls the database regularly to find out if any instances are in need of being woken up).
Richard Gavel
reply 4

You can use google to search for other answers

 

More Articles

• Cannot create more than one WorkflowRuntime per AppDomain
• properties - file dialog
• WorkflowRequestContext.Current.WorkflowRuntime Error
• How to create a workflow about asp.net?
• Why I can not combind the SqlTracking & SqlPerstance Service ...
• Trouble with WF HOL Lab 3
• Workflow Instance Persistance - and Reload
• UpdateDefaultTrackingProfile doesnt fire the event associated wit...
• Package load error when starting VS.NET 2005
• How to create a customised persistence service
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Request For Code Sample
• SqlTrackingQuery requries access to Types
• Asp.Net and workflow
• Create Tracking/ persitence database for
• Base Class and Inheritance
• Hands On Labs for the Vista 5472 build?
• PublicToken for custom assemblies
• About the SqlStatePersistenceService?
• Workflow enabled ASP.NET WebCast on Tomo
• Question about EventDeliveryFailedExcept
• debugging problem
• Hide compensation tab
• Still issues using generic List as prope
• WWF
• Making a GUI subservient to the WF

Hot Articles

• Type resolution problem executing a work
• Best archtiecture for long runnig workfl
• Generic state workflow with limited access
• Workflow Designer Flexibility
• Code Activity context menu questions
• Lab 10 on beta 2.2
• MOSS Publishing Site
• rule engine standards
• 'advanced' tracking
• Lab4 problem : OrderCreated event is nev
• What I'm doing wrong in web.config?
• activity size does not change OnLayoutSize
• WorkflowPersistence question
• Problems migrating a TrackingService imp
• Custom activity based on HandleExternalE

Recommend Articles

• workflow compiler
• Scalability for Hosting Multiple Instanc
• Which design is better for ASP.NET WWF a
• Latest on ASP.Net & Workflow
• ASP.NET and WF viable?
• PersistOnCloseAttribute
• Issues in SQLTrackingService
• Converting existing workflow from code b
• Changing which workflow items are availa
• Property declared in Custom State Machin
• sending data to a single workflow instan
• Hosting the WWF Designer
• Lab 03 - Exercice 3
• Persistence service exception
• Workflow terminated by runtime - error d