SendMessageChannelCache 類別

定義

代表擴充,這個擴充能讓您自訂快取共用層級、通道處理站快取的設定,以及使用 Send 傳訊活動傳送訊息至服務端點的工作流程之通道快取的設定。

public ref class SendMessageChannelCache sealed : IDisposable
public sealed class SendMessageChannelCache : IDisposable
type SendMessageChannelCache = class
    interface IDisposable
Public NotInheritable Class SendMessageChannelCache
Implements IDisposable
繼承
SendMessageChannelCache
實作

範例

下列範例將示範如何使用 SendMessageChannelCache 類別,在單一應用程式定義域中共用兩個工作流程應用程式之間的通道快取。


//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);

備註

這個類別適用於將訊息傳送至服務端點的工作流程。 這些工作流程通常是用戶端工作流程,但也可以是裝載於 WorkflowServiceHost 中的工作流程服務。

根據預設,在 WorkflowServiceHost 所裝載的工作流程中,Send 中的所有工作流程執行個體會共用 WorkflowServiceHost 傳訊活動使用的快取 (主機層級快取)。 針對並非由 WorkflowServiceHost 裝載的用戶端工作流程,快取只能供工作流程執行個體使用 (執行個體層級快取)。 工作流程中的傳送活動若在組態中定義了端點,快取會依預設停用。

如需如何變更通道處理站和通道快取的預設快取共用層級和快取設定的詳細資訊,請參閱 變更傳送活動的快取共用層級

建構函式

SendMessageChannelCache()

使用預設的處理站快取和通道快取設定,初始化 SendMessageChannelCache 類別的新執行個體。

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings)

使用自訂的處理站快取和通道快取設定,初始化 SendMessageChannelCache 類別的新執行個體。

SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean)

使用自訂處理站快取設定、自訂通道快取設定,以及指出是否要開啟快取的值,初始化 SendMessageChannelCache 類別的新執行個體。

屬性

AllowUnsafeCaching

取得或設定值,這個值會指出是否要開啟快取功能。

ChannelSettings

取得或設定通道快取的設定。

FactorySettings

取得或設定通道處理站快取的設定。

方法

Dispose()

釋放 SendMessageChannelCache 類別目前的執行個體所使用的全部資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於