Event driven activity RRS feed

  • Question

  • Hi guys,

    I would like to have an event driven activity in my .Net 4(!) WF application. It should be able to react on some external events from different sources. For example, I receive a message from a non-WCF legacy application and I want to handle it somehow.

    I have seen some implementations of this scenario in WF 3, but I can't find a correct way to "port" this functionality to WF4. Is IEventActivity interface suitable here? How and where should I handle the incoming events in this case? I'm able to subscribe to the event queue but I dont know how to dequeue some incoming events. Here is a code snippet whic applies to WF3:


    protected override ActivityExecutionStatus Execute(

          ActivityExecutionContext executionContext)
          WorkflowQueuingService wqs = executionContext.GetService<WorkflowQueuingService>();
          WorkflowQueue queue = wqs.GetWorkflowQueue(QueueName);
          object data = queue.Dequeue();
          Console.WriteLine("Received {0} in {1}", data, GetType().Assembly.FullName);
          return base.Execute(executionContext);

    ...this is an Execute method of an activity which receives the events. But there seems to be no such implementation of "Execute" method in WF4 classes to peek the message in the queue.

    Thank you very much for help!!

    Tuesday, February 22, 2011 2:32 PM