I am trying to model a notification system where an event occurs during a time period (start date and end date). If the time period has been exceeded, the user is required to either update the time period or set a flag that the event has been i) cancelled, ii) completed, or iii) closed. If today is one day past the event's scheduled completion date, the manager is emailed. If two days, the manager and their supervisor is emailed. If > two days, the manager, their supervisor, and the company owner is emailed. Every day after that it emails the three of them that the event is delinquent. Events can be scheduled any time in the future so the process needs to simply track when the event is Pending, Active, Delinquent (past the end date), Cancelled, Closed, or Complete.
I have started building workflow as a WorkFlow Service application hosted in Windows Server AppFabric because it appears that that is the best way to persist this long-running workflow. I have also started using the WF State Machine Activity Pack CTP 1 as it seemed the best way to model these different event states.
I am uncertain how to model this process as well as get the process to persist and continue running in the background to monitor the event's state and behave as outlined above. I think I have all the states modeled correctly in the state machine. I am still trying to figure out the transitions from one state to another Any guidance is appreciated.
State Machines run in a burst of execution. There is really nothing to "run" while the workflow is persisted. I suspect what you mean is how will the workflow "wake up" when the timeout is exceeded.
The answer is that the Delay activity will create a durable timer. The AppFabric Workflow Management service periodically asks the persistence layer if there are runnable workflow instances - that is instances which have crashed or where a durable timer has expired.
Eventually the timer will be expired and the Workflow will be loaded and the Delay activity bookmark will be resumed.
Related
I have a scheduled state, which invokes scheduled activity. As per states generated and logs, we found scheduler activity stops because of breaking errors and now new state has been created after it. Is it possible to run the scheduler back from the day it stopped. Is it possible to run a flow on a backdate in Corda, given we have access to all the nodes and network.
It's not possible to run the scheduler in a backdated way, e.g. by changing the system clock.
To understand why we need to understand how the scheduler in Corda works.
The scheduling system doesn't loop over the system time to work out when it should run, but instead kicks off the activity once a particular time has elapsed, e.g. if you scheduled the task to run tomorrow at 13:00 at 12:00 today, a timer for 25 hours would be kicked off.
Once that scheduled activity has run, a new timer is calculated and kicked off.
If the node goes down, as soon as it comes back up, it'll work out if any scheduled tasks have been missed and if so, run them immediately. Any future dated scheduled tasks have their timers recalculated.
The best advice would be to run those errored tasks manually.
I have application that should notify user based on some interval pattern like:
Event
> Pushes
Pattern: Immediately - 3 day - 7 day - 12 day
If user made action for event pushes should stops for this event. It is possible to have multiple same type events that should send push when event occurred.
Also I do not want to bother user for example when the one have 5 events to send x5 more pushes, but reduce by taking together pushes that should happens next day (or some other interval) by sending one push for example 'reminder: you have 5 events'.
So now I decide this kind of solution, when event occurred, insert into db all pushes for event that should be send later with datetime for send. If user take action, pushes marks as redundant for this event. And before sending analyze interval for example take all pushes for next 24hour, send one and mark all others as already sent.
Is it ok, or maybe exists better solutions?
I have experience building same application with you. What I'm I doing is :
CMS -> redis -> worker
CMS, are used for creating push notification content, including the time when that content should be sent
Redis, are used for storing the delayed jobs data
Worker, php application that pulling delayed jobs data from Redis. I use Laravel on here, I take advantage from Laravel queue delayed dispatching.
Previously I have try use database and message broker SQS as queue driver. Why I'm switch to redis ? First, when I using database, is too costly, due the traffic of my queue data is very huge. Then when I use SQS, it's better than database, but SQS cannot hold delayed data with weeks age. So my last choice is Redis. Of course we can use another serivce such as Rabbitmq.
I am using windows workflow service and have a need to know when a workflow instance is Idle. Using http://code.msdn.microsoft.com/Windows-Workflow-b9d5ccb7 as a resource, I have created a TrackingParticipant and am being "notified" when certain states occurs, e.g. Idle, Completed, Persisted, Resumed, Unloaded, Deleted, etc.
What I expected was that, only when the workflow instance is finished processing the current activities, that the state goes to Idle. However, it seems to go to Idle even if there is more processing for the workflow instance to perform. For example, I might see consecutive "Idle" states for the same workflow instance. As such, the "Idle" state is not very helpful for me in determining when the workflow instance is no longer processing any activities.
The "Unloaded" state, however, appears to give me what I want. The "Unloaed" state (as far as I can tell) only occurs when the workflow instance has no other activities to perform.
So my question is: Is it safe to rely on the "Unloaded" state to determine if the workflow instance is no longer processing any activities or is there some other technique I should use?
Thanks for your help,
Eric
I have a scenario and want to use multiple ReceiveAndSendReply activities running in parallel situation, each of them will be put in an infinite while loop to make sure all activities are always running and listening. So I used a parallel activity to pack all those ReceiveAndSendReply, and each ReceiveAndSendReply was put in a While activity with condition set to true. And of cause, I put some activities with business logic between Receive activity and SendReplyToRecieve activity.
Now I have a problem if it takes a long time to process a request in one branch, then during that time all other branches will be blocked. Any request for other Receive activities will not be processed, and both client, which include the one called long time run service and the other one who called other service during server process long time run service process, will also get exceptions.
Did anybody have an idea to fix it? Sorry since I am new user, can put post image of my workflow.
The workflow runtime is single treaded in that a given workflow instance only executes on a single thread at any given moment. So while your workflow is busy doing work it can't react to other incoming messages. Normally this isn't a problem as workflow's normally aren't compute intensive and doing async IO is real easy. One thing that might help is adding Delay activities with a real short timeout. They cause the workflow to pause letting it start processing the next request. Also make sure you put as few activities as you can between the Receive and the SendReply and add a short delay right after the SendReply.
Scenario
I have an web application which needs some calculations and processing on data. This job is a long running job(few hours). Job is initiated by user.
Requirement.
User Clicks on Process Data.
Some functions are called to start data processing.
Data Processing runs for hours.
User is given feedback of percentage completed etc.
Even if user logs off and then again log on he should get this feedback.
The requirement is somewhat similar to Spiceworks. Where it runs in background to detect the devices/computers in network and the user is notified in his page about the progress. But spicework uses windows service. We don't want to us windows service.
Now the question is.
What if user closes the page, will the task still run in background.
This task has to be completed fully.If terminated in between output will not have any meaning.
How to actually to design this long running process. In ASP.Net environment.
Also is there a way to show all/same user who logs in the status of processing.
There are multiple ways to schedule a job in the background. You can use SQL Job, Windows Service or Scheduled Tasks.
I would design it like this:
From my ASP.NET page - I will store an indication in the database for the job to start which will then be picked by the scheduled task. This task is nothing but a console application which pulls data from the database to see which tasks user initiated and then take the next action in there.. For the percetage complete you can store those values from your job into DB and your page will access the dB to show it to user anytime they come to the page.
Here is another thread where long running tasks in IIS are discussed:
Can I use threads to carry out long-running jobs on IIS?