SendMessageChannelCache SendMessageChannelCache SendMessageChannelCache SendMessageChannelCache Class

Definition

Represents an extension that enables the customization of the cache sharing levels, the settings of the channel factory cache, and the settings of the channel cache for workflows that send messages to service endpoints using Send messaging activities.

public ref class SendMessageChannelCache sealed : IDisposable
public sealed class SendMessageChannelCache : IDisposable
type SendMessageChannelCache = class
    interface IDisposable
Public NotInheritable Class SendMessageChannelCache
Implements IDisposable
Inheritance
SendMessageChannelCacheSendMessageChannelCacheSendMessageChannelCacheSendMessageChannelCache
Implements

Examples

The following example shows how to use the SendMessageChannelCache class to share a channel cache between two workflow applications in a single app domain.


//sharing a channel cache between two workflow applications in a single app-domain.
sharedChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 5 }, new ChannelCacheSettings { MaxItemsInCache = 5 });

WorkflowApplication workflowApp1 = new WorkflowApplication(workflow);
workflowApp1.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp1.Extensions.Add(sharedChannelCache);

WorkflowApplication workflowApp2 = new WorkflowApplication(workflow);
workflowApp2.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp2.Extensions.Add(sharedChannelCache);

//disabling the channel cache so that channels are closed after being used.
SendMessageChannelCache disabledChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 0 }, new ChannelCacheSettings { MaxItemsInCache = 0 });

WorkflowApplication workflowApp3 = new WorkflowApplication(workflow);
workflowApp3.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp3.Extensions.Add(disabledChannelCache);

Remarks

This class is intended for workflows that send messages to service endpoints. These workflows are typically client workflows but could also be workflow services that are hosted in a WorkflowServiceHost.

By default, in a workflow hosted by a WorkflowServiceHost, the cache used by Send messaging activities is shared across all workflow instances in the WorkflowServiceHost (host-level caching). For a client workflow that is not hosted by a WorkflowServiceHost, the cache is available only to the workflow instance (instance-level caching). Caching is disabled by default for any send activity in your workflow that has endpoints defined in configuration.

For more information about how to change the default cache sharing levels and cache settings for the channel factory and channel cache, see Changing the Cache Sharing Levels for Send Activities.

Constructors

SendMessageChannelCache() SendMessageChannelCache() SendMessageChannelCache() SendMessageChannelCache()

Initializes a new instance of the SendMessageChannelCache class with default factory cache and channel cache settings.

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

Initializes a new instance of the SendMessageChannelCache class with custom factory cache and channel cache settings.

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean)

Initializes a new instance of the SendMessageChannelCache class with custom factory cache settings, custom channel cache settings, and a value that indicates whether to turn caching on.

Properties

AllowUnsafeCaching AllowUnsafeCaching AllowUnsafeCaching AllowUnsafeCaching

Gets or sets a value that indicates whether to turn caching on.

ChannelSettings ChannelSettings ChannelSettings ChannelSettings

Gets or sets the settings of the channel cache.

FactorySettings FactorySettings FactorySettings FactorySettings

Gets or sets the settings of the channel factory cache.

Methods

Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the current instance of the SendMessageChannelCache class.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to