I have now uploaded the BRE Pipeline Framework v1.5.4 installer to the CodePlex project page. This version is as always fully backwards compatible with BRE Policies created with previous versions, and installing it over an existing version simply requires uninstalling the currently installed version, installing the new version, and importing the new vocabularies from the program files folder (default location is C:\Program Files (x86)\BRE Pipeline Framework\Vocabularies).
In a previous post I discussed a pattern that allows for the temporary persistence of context properties on a request message in a request/response send port, and then reapplying those context properties on the response message before it gets sent to the BizTalk message box. The beauty of this pattern is that it allows you to enrich response messages with state from the request message without the need for orchestration. The temporary persistence store that I used for these context properties is based on the .Net MemoryCache class.
One of the features of the MemoryCache class is that it is really easy to set expiry times on cached items so you aren’t forced to explicitly remove items from the cache (though you still have the ability to), and setting expiry times and explicitly deleting cached items are features provided for in the BRE Pipeline Framework.
The MemoryCache class also has a feature whereby if the server is under heavy pressure for memory it will automatically drop items from the cache. This is great when the items in the cache are truly temporary and you have a means of reloading the item in the cache, however doesn’t work very well for the pattern described in my previous post which depends on the cached items being available. To get around this I have taken advantage of the Priority property in the CacheItemPolicy class, which allows you to override this default behavior, instructing .Net not to automatically remove your cached items.
This feature is introduced in the BREPipelineFramework.SampleInstructions.CachingInstructions vocabulary v1.1’s vocabulary definition called SetCachingPriority. You have two priority values that you can apply as below.
- Default – this implies that .Net should remove cached items automatically if under memory pressure. If you don’t use the SetCachingPriority vocabulary definition then this value will be automatically chosen. Cached items can also be removed based on expiry time or based on explicit removal.
- NotRemovable – this instructs .Net not to ever remove cached items, even if under memory pressure. Cached items can only be removed based on expiry time or based on explicit removal.
An example usage of the SetCachingPriority vocabulary definition is in the screenshot below.