Victor Lu

Following here is my code :

////////// Initialize the StateMachine, MySrv implements the IBugService interface.

.................

//////// Raise some events

   MySrv.RaiseBugCreatedEvent(instance.InstanceId, 1);
   MySrv.RaiseBugResolvedEvent(instance.InstanceId, 1);

...........

the statemachine has been designed that a bug can be resolved when it is just created.


When my program runs at the second line "MySrv.RaiseBugResolvedEvent(instance.InstanceId, 1);",  the system sometimes throws the exception

"ex.InnerException {"Queue 'Message Properties
Interface Type:StateMachineApp.IBugService
Method Name:BugResolved

CorrelationValues:
' is not enabled."} System.Exception {System.InvalidOperationException}"

Who could telll me why the system sometimes throws this exception and sometimes not




Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Pravin Indurkar - MSFT

Hi Victor,

This error is happening because you are creating the instance and then immidiately raising the event. The state machine workflow instance has in the meantime not been fully created and not reached the initial state, So what you need to do is use a boolean flag in the ExternalDataEventArgs which you use (most probably you derive from it). There is a flag called WaitForIdle, please set it to true and the raising of the event should work fine. What this flag does it that it waits for the instance to become idle and then it tries to enqueue the message. In the idle state the state machine would have created the queues it needed to.

Thanks

Pravin Indurkar





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Victor Lu

Hi Pravin,

I am very glad to get your help.






Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

RTEKI

 Hi Pravin,

I am getting this error when an event a state cannot / does not handle is being raised... As per my understanding, the exception that should be raised is an InvalidOperationException... Isn't that correct

TIA

Regards

RTEKI





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

FcoLomas

Hi!! I have a very similar problem, everything is right with my workflow and the app, but if you add an sqlpersistence service starts to show the QueueException with with the message from the original post, the instances persist when idle and everything goes right until you try to raise an event, and if you set the ExternalDataEventArgs WaitForIdle to true it never raises the event, any idea






Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

RTEKI

What state is your workflow in when you are trying to raise the event A good place to check what is happening to the workflow is the log created when you enable tracing on the workflow. Ensure that your workflow instance is started when you raise the event - otherwise it just queues the event till the time the instance is actually started.





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

mehdi Jafari

hi Victor

i have same problem

how to set "WaitForIdle" in the "ExternalDataEventArgs" .

please help me.

thanks





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Sonalic - MSFT

ExternalDataEventArgs args = new ExternalDataEventArgs(workflowInstanceId);
args.WaitForIdle = true;






Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Sebastian Kralemann

Hi Pravin!

I thought that after the call to "CreateWorkflow" all queues are set up, because this method initializes all activities in the workflow in a synchronous way. I read this in Dharma Shuklas book. I have looked in the implementation of the HandleExternalEventActivity and saw that it initializes it's queue in the "Initialize" method. Therefore the event firering should not be too early.

If my assumption is wrong, Microsoft should think about to set the WaitForIdle flag to "true" by default! You see how many people getting problems with this poor design. I would expect that all queues are set up after a call to "CreateWorkflow", otherwise the workflow is not really created.

Bye, Sebastian





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Sebastian Kralemann

Hi again!

Maybe MSFT can write something to my statements above!

Thanks in advance!

Sebastian





Re: Windows Workflow Foundation about exception "Queue '......' ' is not enabled."

Tom Lake - MSFT

You are correct for a sequential workflow but with a state machine only the handle external events within a state are subscribed to when the workflow transitions to that state.