tailieunhanh - microsoft press windows workflow foundation step by step phần 10

Tham khảo tài liệu 'microsoft press windows workflow foundation step by step phần 10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 392 Part IV External Data Communication HandleExternalEvent activities. We used the tool to create custom activities for us based on our interface. We could have used the CallExternalEvent and HandleExternalEvent activities directly providing each with the interface and method or event to process but creating custom activities highlights their use in our workflows. With the interface in hand we then created a local service that we plugged in to the workflow runtime to manage our local communications needs. The local service consisted of a data connector and a service class. When the application needed to send data to the workflow it requested the service from the workflow runtime and then raised the events supported by the interface. Your workflow instance would then handle those events assuming you dropped the event handler into the workflow and invoked the event at an appropriate time for example when the workflow anticipated the event and was ready and waiting with the correct event handler . The workflow on the other hand had no such need to query the workflow runtime for the local communication service. By dropping instances of CallExternalMethod in your workflow s processing path the host would automatically be told of the data s arrival again assuming the host application hooked an event handler into the local communication service for the received data event. The workflow runtime keeps track of workflow instances and their association with the local communication service and therefore the host application. Correlation Consider that last paragraph again. The workflow instance didn t need to rummage around to find the service that communicates with the host application. Yet the host application did need to query for the local communication service. Although this in part is due to the nature of host interaction with the workflow runtime the process also underscores the one-to-many relationship between the host application and workflow instances. The .

TỪ KHÓA LIÊN QUAN