/// <summary>
/// 该格式化器使输入即输出
/// </summary>
public class StringFormatter : IMessageFormatter
{ public bool CanRead(Message message)
{
return false;
} public object Read(Message message)
{
return null;
} public void Write(Message message, object obj)
{
var b = Encoding.UTF8.GetBytes(obj + "");
var m = new MemoryStream(b);
message.BodyStream = m;
} public object Clone()
{
return null;
}
} //......
MessageQueue.Formatter = new StringFormatter();
//......