locked
How to run a workflow with a callback RRS feed

  • Question

  • I have a client workflow which will call a WCF service and wait for the reply. I used the duplex communication. Everything is almost working except that the client workflow can't be executed using workflowapplication because the callback service is not hosted and the WCF server can't find the listening port.

    I also tried to host the client workflow in a workflowservicehost. However, this way I can't run the activity properly because the workflow extensions can only be set in the host level, when running the activity using host.Activity.RunWithWorkflowApplication() the activities can't get any extension objects. Ideally it would be nice to run the client workflow while being able to host the callback endpoint.

    Saturday, February 4, 2012 1:00 AM

Answers

  • Hi,

    What's do you mean by host.Activity.RunWithWorkflowApplication()? As far as I know, WorkflowApplication doesn't support messaging activities.

    ->I also tried to host the client workflow in a workflowservicehost. However, this way I can't run the activity properly because the workflow extensions can only be set in the host level

    Actually, we can register activity's own extension during CacheMetadata() by calling ActivityMetadata.AddDefaultExtensionProvider<T>(). For the detailed information, you can refer to:

    (WF4) Workflow 4.0 Hosting Extensions
    http://blogs.msdn.com/b/tilovell/archive/2010/06/08/wf4-workflow-4-0-hosting-extensions.aspx

    Hope this helps, thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by leafinwind Monday, February 6, 2012 5:13 PM
    Monday, February 6, 2012 7:45 AM

All replies

  • Hi,

    What's do you mean by host.Activity.RunWithWorkflowApplication()? As far as I know, WorkflowApplication doesn't support messaging activities.

    ->I also tried to host the client workflow in a workflowservicehost. However, this way I can't run the activity properly because the workflow extensions can only be set in the host level

    Actually, we can register activity's own extension during CacheMetadata() by calling ActivityMetadata.AddDefaultExtensionProvider<T>(). For the detailed information, you can refer to:

    (WF4) Workflow 4.0 Hosting Extensions
    http://blogs.msdn.com/b/tilovell/archive/2010/06/08/wf4-workflow-4-0-hosting-extensions.aspx

    Hope this helps, thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by leafinwind Monday, February 6, 2012 5:13 PM
    Monday, February 6, 2012 7:45 AM
  • Thanks Leo for your reply. If workflowapplication doesn't support messaging activities, then what's the best way to run a workflow with a messaging activity?

    Is WorkflowServiceHost a good candidate. If I use that, how do I start the workflow activity? This class only provide Open() function which only opends the listen point but doesn't actually start the workflow instance.

    The only thing I need is the ability to add extension and start the workflow within the host. Could you advise how I could do that?

    Thanks.

    Monday, February 6, 2012 5:17 PM
  • Hi,

    WorkflowServiceHost provides support for messaging activities and is primarily used with workflow services. The workflow services must receive a message to start a workflow instance. To add workflow extensions, you can refer to:

    How do I add an extension to a WCF Workflow Service?

    http://wf.codeplex.com/wikipage?title=How%20do%20I%20add%20an%20extension%20to%20a%20WCF%20Workflow%20Service%3f

    Thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 7, 2012 9:45 AM