Girish Pawar

The requirement is that when

1. user press submit button, it loads a page using callexternal method.

2.user donot take any action for 30 minutes, transition of workflow to next state.

Please help somebody...!



Re: Windows Workflow Foundation Can we implement listening to more than two events in state machine.

Bruce Bukovics

Yes, a state (or a state machine workflow) can listen for multiple events at the same time. All you need to do is add an EventDrivenActivity to the state for each event that you need to handle. Each EventDrivenActivity represents a branch of execution for one event.

One of those EventDrivenActivity instances would contain the HandleExternalEventActivity which listens for your "take some action" external event. The other EventDrivenActivity could contain a DelayActivity which is set to a time of 30 minutes. If the "take some action" event isn't received before the DelayActivity expires, the activities that you define under the DelayActivity will execute. That could include transitioning to another state.

Hope this helps.

Bruce Bukovics http://www.bukovics.com
Pro WF: Windows Workflow in .NET 3.0 http://www.learnworkflow.com
.NET 2.0 Interoperability Recipes http://www.interopbook.com




Re: Windows Workflow Foundation Can we implement listening to more than two events in state machine.

Girish Pawar

Thanks for the reply.... Bruce.

I never got such a fast reply...

This is what i have done....

I am using sqlPersistenceservice...

In one of the states i have implemented 2 eventdrivenactivities...

1.Waiting for a event.if event happen change to state A.

2.Waiting for timeout of 1 minute... if timeout happens i change the state to state B.

But it doesn't seem to work.

Even after 1 minute the workflow stays in the same state...waiting for the event.

What must i do





Re: Windows Workflow Foundation Can we implement listening to more than two events in state machine.

Girish Pawar

This is Girish.

I have a similar problem...

I have a situation where ..

                       Listen

          -----------------------------------------

         |                                                  |

eventA                                           Delay = 1min

change to stateA                          change to stateB

So did the following thing...in stateMachine

1.EventDrivenActivity1

         HandleExternalEvent1

         change state to stateA

2.EventDrivenActivity2

       DelayActivity = 1min(For demo purpose)

       change state to stateB

I am using SqlPersistenceService with ManualWorkflowSchedulerService--

If I use DefaultWorkflowSchedulerService with AutoResetEvent it works...

 

But in case of  ManualWorkflowSchedulerService even after timeout the workflow remains in the same state waiting for HandleExternalActivity1....

The problem is that workflow goes to idle state when it encounters two events, so timeout is having no effect(even after i removed SqlPersistenceService).

Please Help....

What should i do





Re: Windows Workflow Foundation Can we implement listening to more than two events in state machine.

Girish Pawar

Bruce,

The problem is that I am using ManualWorkflowSchedulerService.

Because it is recommended for ASP.Net .

The eventdriven technique works perfectly fine with DefaultWorkflowSchedulerService.

If I use DefaultWorkflowSchedulerService with "AutoResetEvent".

One Thread waiting for other, will there be performance problems in Web Server.

or is there any technique to make it work with ManualWorkflowSchedulerService

Thanks for your reply.