Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Posts a message to the specified workflow queue synchronously.
public:
void EnqueueItem(IComparable ^ queueName, System::Object ^ item, System::Workflow::Runtime::IPendingWork ^ pendingWork, System::Object ^ workItem);
public void EnqueueItem(IComparable queueName, object item, System.Workflow.Runtime.IPendingWork pendingWork, object workItem);
member this.EnqueueItem : IComparable * obj * System.Workflow.Runtime.IPendingWork * obj -> unit
Public Sub EnqueueItem (queueName As IComparable, item As Object, pendingWork As IPendingWork, workItem As Object)
The name of the WorkflowQueue.
The object to enqueue.
An IPendingWork that allows the sender to be notified when item
is delivered.
An object to be passed to the IPendingWork methods.
queueName
is a null reference (Nothing
in Visual Basic).
The workflow runtime engine is not running.
-or-
The WorkflowQueue specified by queueName
does not exist.
-or-
The WorkflowQueue specified by queueName
is not enabled.
Sends the item
to the specified WorkflowQueue. 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 using this method with a state machine workflow, you might get an exception with the message "Queue '{0}' is not enabled." This happens 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}'.
Note
Messages are not guaranteed to be received by the workflow instance in the order that they were sent. For example, if receiving a message in an existing queue (Queue A) causes a workflow to create another queue (Queue B), which then listens for another message sent after the first message, it is possible that the second message will arrive first, and will not be received due to its queue not being created yet. To prevent this issue, the second message should not be sent until the presence of the second queue is verified (using GetWorkflowQueueData.)
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in