protected virtual BaseMessage CreateNmsMessage(Message message) { BaseMessage result = null; if ("amqp/map" == message.ContentType) { Dictionary <string, object> dict = new Dictionary <string, object>(); message.GetContent(dict); PrimitiveMap bodyMap = new PrimitiveMap(); SetNmsPrimitiveMap(bodyMap, dict); MapMessage mapMessage = new MapMessage(); mapMessage.Body = bodyMap; result = mapMessage; } else if ("amqp/list" == message.ContentType) { Collection <object> coll = new Collection <object>(); message.GetContent(coll); ObjectMessage objMessage = new ObjectMessage(); objMessage.Body = ConvertAmqpListToObject(coll); result = objMessage; } else { TextMessage textMessage = new TextMessage(); textMessage.Text = message.GetContent(); result = textMessage; } return(result); }
public IObjectMessage CreateObjectMessage(Object body) { ObjectMessage answer = new ObjectMessage(); answer.Body = body; return(answer); }
protected virtual Message CreateAmqpMessage(IMessage message) { if (message is TextMessage) { TextMessage textMessage = message as TextMessage; Message result = new Message(textMessage.Text); return(result); } else if (message is BytesMessage) { BytesMessage bytesMessage = message as BytesMessage; Message result = new Message(bytesMessage.Content, 0, bytesMessage.Content.Length); return(result); } else if (message is ObjectMessage) { ObjectMessage objectMessage = message as ObjectMessage; Collection <object> objs = new Collection <object>(); objs = ConvertObjectToAmqpList(objectMessage.Body); Message result = new Message(objs); return(result); } else if (message is MapMessage) { MapMessage mapMessage = message as MapMessage; PrimitiveMap mapBody = mapMessage.Body as PrimitiveMap; Dictionary <string, object> dict = FromNmsPrimitiveMap(mapBody); Message result = new Message(dict); return(result); } else if (message is StreamMessage) { StreamMessage streamMessage = message as StreamMessage; Message result = new Message(streamMessage.Content, 0, streamMessage.Content.Length); return(result); } else if (message is BaseMessage) { Message result = new Message(); return(result); } else { throw new Exception("unhandled message type"); } }
protected virtual BaseMessage CreateNmsMessage(Message message) { BaseMessage result = null; if ("amqp/map" == message.ContentType) { Dictionary<string, object> dict = new Dictionary<string,object>(); message.GetContent(dict); PrimitiveMap bodyMap = new PrimitiveMap(); SetNmsPrimitiveMap(bodyMap, dict); MapMessage mapMessage = new MapMessage(); mapMessage.Body = bodyMap; result = mapMessage; } else if ("amqp/list" == message.ContentType) { Collection<object> coll = new Collection<object>(); message.GetContent(coll); ObjectMessage objMessage = new ObjectMessage(); objMessage.Body = ConvertAmqpListToObject(coll); result = objMessage; } else { TextMessage textMessage = new TextMessage(); textMessage.Text = message.GetContent(); result = textMessage; } return result; }
public IObjectMessage CreateObjectMessage(Object body) { ObjectMessage answer = new ObjectMessage(); answer.Body = body; return answer; }