Share via


WorkflowQueuingService.CreateWorkflowQueue(IComparable, Boolean) メソッド

定義

指定した名前およびトランザクション スコープを使用して、WorkflowQueue を作成します。

public:
 System::Workflow::Runtime::WorkflowQueue ^ CreateWorkflowQueue(IComparable ^ queueName, bool transactional);
public System.Workflow.Runtime.WorkflowQueue CreateWorkflowQueue (IComparable queueName, bool transactional);
member this.CreateWorkflowQueue : IComparable * bool -> System.Workflow.Runtime.WorkflowQueue
Public Function CreateWorkflowQueue (queueName As IComparable, transactional As Boolean) As WorkflowQueue

パラメーター

queueName
IComparable

キューの名前。

transactional
Boolean

現在のトランザクション スコープの範囲外で WorkflowQueue が可視かどうかを指定する値。

戻り値

WorkflowQueue オブジェクト。

例外

queueName が null 参照 (Visual Basic の場合は Nothing) です。

WorkflowQueue で指定した名前を持つ queueName が既に存在します。

次のコード例は、CreateQueue という名前のメソッドを示しています。このメソッドは、WorkflowQueuingService メソッドを呼び出して ActivityExecutionContext.GetService オブジェクトを初期化します。 コードでは、初期化後に Exists メソッドを使用して、指定した名前の WorkflowQueue が存在するかどうかを確認します。 存在しない場合は、CreateWorkflowQueue メソッドを呼び出します。存在する場合は GetWorkflowQueue メソッドを呼び出します。

このコード例は、FileSystemEvent.cs ファイルに含まれている、ファイル監視アクティビティの SDK サンプルの一部です。 詳細については、「 ファイル システム ウォッチャー アクティビティ」を参照してください。

private WorkflowQueue CreateQueue(ActivityExecutionContext context)
{
    Console.WriteLine("CreateQueue");
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
    {
        qService.CreateWorkflowQueue(this.QueueName, true);
    }

    return qService.GetWorkflowQueue(this.QueueName);
}
Private Function CreateQueue(ByVal context As ActivityExecutionContext) As WorkflowQueue
    Console.WriteLine("CreateQueue")
    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.queueName) Then
        qService.CreateWorkflowQueue(Me.queueName, True)
    End If

    Return qService.GetWorkflowQueue(Me.QueueName)
End Function

注釈

指定した WorkflowQueue を使用して queueName が作成されます。 transactional が true の場合、WorkflowQueue は現在のトランザクションの範囲内でのみ可視です。

適用対象

こちらもご覧ください