編集

次の方法で共有


WorkflowInstance.EnqueueItemOnIdle Method

Definition

Posts a message to the specified workflow queue when the workflow is idle. EnqueueItemOnIdle(IComparable, Object, IPendingWork, Object) waits until the workflow reaches an idle point and enqueues after verifying that the workflow scheduler is idle (that is, no active operation is being executed).

public:
 void EnqueueItemOnIdle(IComparable ^ queueName, System::Object ^ item, System::Workflow::Runtime::IPendingWork ^ pendingWork, System::Object ^ workItem);
public void EnqueueItemOnIdle(IComparable queueName, object item, System.Workflow.Runtime.IPendingWork pendingWork, object workItem);
member this.EnqueueItemOnIdle : IComparable * obj * System.Workflow.Runtime.IPendingWork * obj -> unit
Public Sub EnqueueItemOnIdle (queueName As IComparable, item As Object, pendingWork As IPendingWork, workItem As Object)

Parameters

queueName
IComparable

The name of the WorkflowQueue.

item
Object

The object to enqueue.

pendingWork
IPendingWork

An IPendingWork that allows the sender to be notified when item is delivered.

workItem
Object

An object to be passed to the IPendingWork methods.

Exceptions

queueName is a null reference (Nothing in Visual Basic).

The workflow runtime engine is not running.

-or-

The workflow instance is suspended.

-or-

The WorkflowQueue specified by queueName does not exist.

-or-

The WorkflowQueue specified by queueName is not enabled.

Remarks

Waits for the workflow instance to become idle and then sends the item to the specified WorkflowQueue. If you call EnqueueItemOnIdle while the workflow instance is suspended, the workflow runtime engine will throw an InvalidOperationException. If you want to be notified when the message is delivered, you can implement IPendingWork in your service and pass a workItem and an IPendingWork object to EnqueueItem. If you do not want such notification, you can pass a null reference (Nothing in Visual Basic) for pendingWork and workItem.

When you are using this method with a state machine workflow, you might get an exception that contains the message "Queue '{0}' is not enabled." This occurs when the current state of the state machine does not know how to handle a specific event. For example, when some state other than the current state contains the EventDrivenActivity that contains the HandleExternalEventActivity that is represented by the queue '{0}'.

Applies to