Share via


Configure Workflow Persistence Using Windows Server AppFabric Cmdlets

You can use AppFabric cmdlets to get or set SQL Server persistence settings for workflow services. You can configure persistence features at the service level for a specific workflow service, or at a server, site, or application scope and have the service inherit these settings defined at a higher level. For more information about how configurations work in the IIS hierarchy, see Configuration Process in Windows Server AppFabric.

Note

To execute an AppFabric cmdlet interactively, you will need to use the Windows PowerShell console for Windows Server AppFabric, enter the appropriate cmdlet, and then press ENTER. For more information about executing AppFabric cmdlets in general, see Running Windows Server AppFabric Cmdlets. For detailed information about scope parameters (-SiteName, -VirtualPath, -Uri, and so on), see Cmdlet Scope and for detailed information about piping parameters (ApplicationInfo and ServiceInfo), see Cmdlet Piping.

This topic contains sections that describe how to configure SQL Server persistence features for a workflow service.

To configure SQL Server persistence features for workflow services by using cmdlets

This section describes how to use AppFabric cmdlets to get, set, or clear values of the SQL Server persistence-related elements and attributes in the configuration file associated with the specified scope.

Cmdlet

Description

Get-ASAppSqlServicePersistence

Gets the values of the persistence related elements and attributes of the sqlWorkflowInstanceStore element in the configuration file associated with the specified scope.

Set-ASAppSqlServicePersistence

Sets the values of the persistence related elements and attributes of the sqlWorkflowInstanceStore element in the configuration file associated with the specified scope.

Clear-ASAppSqlServicePersistence

Clears or removes the sqlWorkflowInstanceStore element from the configuration file associated with the specified scope.

Syntax options for the Get-ASAppSqlServicePersistence cmdlet

// to get workflow service persistence settings at the root level
Get-ASAppSqlServicePersistence -Root

// to get workflow service persistence settings at the Web site level
Get-ASAppSqlServicePersistence -SiteName <String> 

// to get workflow service persistence settings at the virtual application or service level that the VirtualPath points to 
Get-ASAppSqlServicePersistence -SiteName <String> -VirtualPath <String>] 

// to get workflow service persistence settings at the site, virtual application or service level that the Uri points to
Get-ASAppSqlServicePersistence -Uri <Uri> 

// to get workflow service persistence settings at the application level specified by the ApplicationObject.
Get-ASAppSqlServicePersistence -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Get-ASAppSqlServicePersistence

// to get workflow service persistence settings at the service level specified by the Service Object
Get-ASAppSqlServicePersistence -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Get-ASAppSqlServicePersistence

Syntax options for the Set-ASAppSqlServicePersistence cmdlet

Set-ASAppSqlServicePersistence [-SiteName] <String> [[-VirtualPath] <String>] [-ConnectionString <String>] [-ConnectionStringName <String>] [-EnableNetPipeProtocol] [-HostLockRenewalPeriod <TimeSpan>] [-InstanceCompletionAction {DeleteAll | DeleteNothing}] [-InstanceEncodingOption {GZip | None}] [-InstanceLockedExceptionAction {AggressiveRetry | BasicRetry | NoRetry}] [-RunnableInstancesDetectionPeriod <Time>] [-UseInherited] [<CommonParameters>]

Set-ASAppSqlServicePersistence [-Uri] <Uri> [-ConnectionString <String>] [-ConnectionStringName <String>] [-EnableNetPipeProtocol] [-HostLockRenewalPeriod <TimeSpan>] [-InstanceCompletionAction {DeleteAll | DeleteNothing}] [-InstanceEncodingOption {GZip | None}] [-InstanceLockedExceptionAction {AggressiveRetry | BasicRetry | NoRetry}] [-RunnableInstancesDetectionPeriod <Time>] [-UseInherited] [<CommonParameters>]

Set-ASAppSqlServicePersistence -ApplicationObject <ApplicationInfo> [-ConnectionString <String>] [-ConnectionStringName <String>] [-EnableNetPipeProtocol] [-HostLockRenewalPeriod <TimeSpan>] [-InstanceCompletionAction {DeleteAll | DeleteNothing}] [-InstanceEncodingOption {GZip | None}] [-InstanceLockedExceptionAction {AggressiveRetry | BasicRetry | NoRetry}] [-RunnableInstancesDetectionPeriod <Time>] [-UseInherited] [<CommonParameters>]

Set-ASAppSqlServicePersistence -ServiceObject <ServiceInfo> [-ConnectionString <String>] [-ConnectionStringName <String>] [-EnableNetPipeProtocol] [-HostLockRenewalPeriod <TimeSpan>] [-InstanceCompletionAction {DeleteAll | DeleteNothing}] [-InstanceEncodingOption {GZip | None}] [-InstanceLockedExceptionAction {AggressiveRetry | BasicRetry | NoRetry}] [-RunnableInstancesDetectionPeriod <Time>] [-UseInherited] [<CommonParameters>]

Set-ASAppSqlServicePersistence [-ConnectionString <String>] [-ConnectionStringName <String>] [-EnableNetPipeProtocol] [-HostLockRenewalPeriod <TimeSpan>] [-InstanceCompletionAction {DeleteAll | DeleteNothing}] [-InstanceEncodingOption {GZip | None}] [-InstanceLockedExceptionAction {AggressiveRetry | BasicRetry | NoRetry}] [-Root] [-RunnableInstancesDetectionPeriod <Time>] [-UseInherited] [<CommonParameters>]

The following table lists the parameters that are specific to the Set-ASAppSqlServicePersistence cmdlet.

Parameter

Description

HostLockRenewalPeriod

Specifies the interval within which a host must renew its lock on the workflow service instance before the lock expires. If the host does not renew the lock in the specified time period, the workflow service instance is unlocked and another host may obtain the lock on the instance.

InstanceCompletionAction

Specifies whether the instance state information is kept in the persistence database after the workflow service instance is completed. The allowed values for this parameter are: DeleteAll and DeleteNothing.

InstanceEncodingOption

Specifies whether the instance state information is compressed using the GZip algorithm before the information is saved in the persistence store. The possible values are GZip and None.

InstanceLockedExceptionAction

Specifies what action a service host should take when it receives an InstanceLockedException when the host tries to lock a workflow service instance that is currently locked by another host. The options for this field are as follows: NoRetry, BasicRetry, and AggressiveRetry. The following list provides the descriptions for these three options:

  • NoRetry. The service host does not attempt to lock the workflow service instance and passes the InstanceLockedException to the caller.  If your workflow stays in memory for a period exceeding 60 seconds, use NoRetry as the retry. The default value is NoRetry.

  • BasicRetry. The service host reattempts to lock the workflow service instance with a linear interval between retry attempts and passes the InstanceLockedException to the caller at the end of the sequence. If you workflow stays in memory approximately between 5-60 seconds, and messages arrive in batches where it is more likely for messages being sent to the same instance on the same host to process all messages before unloading the workflow, use BasicRetry to achieve the best latency without wasting resources.

  • AggressiveRetry. The service host reattempts to lock the workflow service instance with an exponential backoff interval between retry attempts, and passes the exception to the caller at the end of the sequence. If your workflow stays in memory for a very short time (less than 5 seconds), or a Web farm is large and the chance of another message being delivered to the same host is not very high, use AggressiveRetry to achieve the best latency.

Note

With both BasicRetry and AggressiveRetry, the time-out is automatically set to whatever the time-out is of the call and cannot be configured.

Runnable instances detection period

Specifies the time period after which the SQL Workflow Instance Store runs a detection task to detect any runnable or activatable workflow instances in the persistence database after the previous detection cycle.

Note

You only need to pass a value for the parameter that you want to change; you do not need to pass values for all the parameters.

Syntax options for the Clear-ASAppSqlServicePersistence cmdlet

Clear-ASAppSqlServicePersistence -Root

Clear-ASAppSqlServicePersistence -SiteName <String> 

Clear-ASAppSqlServicePersistence -SiteName <String> -VirtualPath <String>] 

Clear-ASAppSqlServicePersistence -Uri <Uri> 

Clear-ASAppSqlServicePersistence -ApplicationObject <ApplicationInfo> 
// Ex: Get-ASApplication -SiteName "Default Web Site" -VirtualPath /SampleApp | Clear-ASAppSqlServicePersistence

Clear-ASAppSqlServicePersistence -ServiceObject <ServiceInfo> 
// Ex: Get-ASApplicationService –SiteName “Default Web Site” –VirtualPath “/SampleApp/SampleService.xamlx” | Clear-ASAppSqlServicePersistence