Appendix B. MessageHelper class for Custom Pipeline Components.
As described in the Custom Pipeline components chapter of this document, developers can extend Sentinet Pipeline with custom components. A custom component is a .NET public class that implements an IMessageProcessor interface defined in the Nevatech.Vsb.Repository.dll assembly:
namespace Nevatech.Vsb.Repository.Processing
{
public interface IMessageProcessor
{
void ImportConfiguration(string configuration);
MessagePipelineResult ProcessMessage(MessagePipelineContext context);
}
}
MessageHelper class is a public static class with extension methods that often allow easier access to request and response messages. For example, to get request message’s HTTP header a developer can make a call:
context.Message.GetHttpHeader(true, "MyHeader");
Note, that in the example above GetHttpHeader method of the MessageHelper class is an extension method to the Message class.
Using MessageHelper is not always the easiest way to modify messages. For example, message body can be replaced using direct method of the MessagePipelineContext class:
context.SetMessageBodyContent("my new message body");
Using MessageHelper class the same would lead to this code:
context.Message = MessageHelper.SetMessageBodyContent(context.Message, "my new message body");
At the same time, using MessageHelper.SetMessageBodyContent(context.Message, "my new message body") may be a better choice when it is used outside of the context of the custom pipeline components in some other Sentinet extensibility points.
Complete syntax of the MessageHelper is described in online version of Sentinet .NET API Reference.