Office 365 · SharePoint Designer · Workflow Manager 1.0

Office 365 – SharePoint Designer workflows calling long running web services


Today I created a SharePoint Designer workflow calling a web service. The web service call creates a SharePoint site and applies a PnP template to the site.

In general the setup used by the PnP partner pack where a web job creates the sites and applies PnP templates would work, however in my solution I’ve got multiple site request lists. I’ve got requests lists for team sites, project sites and a few more site creation lists. Creating a single web job scanning through multiple lists may be difficult to maintain.

The issue

The web service call is taking about 10 minutes to complete and the workflow in SharePoint reports a retry

retry

Looking at the Changing Server Configuration Settings for Workflow Manager article there is a WorkflowServiceMaxHttpResponseTime setting that controls the period of time.

WorkflowServiceMaxHttpResponseTime 0:01:00 The amount of time represented as hours:minutes:seconds that defines the response timeout when workflows make Http requests.

You may want to increase this limit if workflows send requests to an endpoint that responds after more than 1 minute. Note:  Workflow Manager 1.0 can concurrently process a fixed number of workflow instances (see WorkflowServiceMaxLoadedInstances) on each server node. You can think about this as each server having a fixed number of workflow execution pipelines. Any workflow instance loaded in memory, including a workflow instance waiting for HTTP response within the configured timeout, uses one of these pipelines. Therefore, increasing WorkflowServiceMaxHttpResponseTime may reduce the cumulative throughput, especially if many workflow instances spend a lot of time waiting on HTTP response.

As I’m using office 365 I’m not able to change this setting.

Potential solutions

Option 1 – Make the web service call Async

By sending the request to the web service and ensuring that the call doesn’t take long to complete there wouldn’t be multiple calls to the web service created.

This would make us loose the communication with the workflow and the workflow would continue straight after the request has been placed.

Option 2 –  Create a scheduled task

This option involves converting the web service code to a console application and then call the application from a windows scheduled task.

It also means that the code will need to scan through multiple requests lists.

Option 3 –  Create a web job in Azure

This option involves converting the web service code to a web job. My customer wants to run the code in an on premises environment. So this isn’t an option for me.

Like with the Scheduled task it also means that the code will need to scan through multiple requests lists.

Option 4 – Create a task/web job to look at a single list

This option involved adding a SharePoint designer workflows to my request lists. These workflows copy the request details to a single location. This single location doesn’t require user access. The scheduled task/web job now only needs to scan through a single list for requests.

The only negative of this solution is that requests are dealt with on a regular interval (e.g. 5 minutes). For site creation this probably doesn’t matter too much. So can we find a way to trigger the web jobs/tasks.

Rather than using a scheduled task a SharePoint Designer workflow could start the creation process by calling a different web service call that uses an Async call to update all outstanding requests.

 

Advertisements

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s