本文整理汇总了C#中ISession.CreateBytesMessage方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.CreateBytesMessage方法的具体用法?C# ISession.CreateBytesMessage怎么用?C# ISession.CreateBytesMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.CreateBytesMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Encode
public IMessage Encode(TransportMessage message, ISession session)
{
if (message.IsControlMessage())
{
IMessage encoded = session.CreateBytesMessage();
if (message.Body != null)
{
encoded = session.CreateBytesMessage(message.Body);
}
return encoded;
}
return null;
}
示例2: Encode
public IMessage Encode(TransportMessage message, ISession session)
{
var contentType = message.Headers[Headers.ContentType];
if (contentType == ContentTypes.Bson || contentType == ContentTypes.Binary)
{
IMessage encoded = session.CreateBytesMessage();
if (message.Body != null)
{
encoded = session.CreateBytesMessage(message.Body);
}
return encoded;
}
return null;
}
示例3: CreateMessageForByteArray
/// <summary> Create a NMS IBytesMessage for the given byte array.</summary>
/// <param name="bytes">the byyte array to convert
/// </param>
/// <param name="session">current NMS session
/// </param>
/// <returns> the resulting message
/// </returns>
/// <throws> NMSException if thrown by NMS methods </throws>
protected virtual IBytesMessage CreateMessageForByteArray(byte[] bytes, ISession session)
{
IBytesMessage message = session.CreateBytesMessage();
message.Content = bytes;
return message;
}
示例4: CreateMessageForByteArray
/// <summary> Create a EMS BytesMessage for the given byte array.</summary>
/// <param name="bytes">the byyte array to convert
/// </param>
/// <param name="session">current EMS session
/// </param>
/// <returns> the resulting message
/// </returns>
/// <throws> EMSException if thrown by EMS methods </throws>
protected virtual BytesMessage CreateMessageForByteArray(byte[] bytes, ISession session)
{
BytesMessage message = session.CreateBytesMessage();
message.WriteBytes(bytes);
return message;
}