Hi,

What you were describing in your first mail is the current way to access the message body. We may want to simplify that by using some less generic message types like a text message. Regarding the headers, there are some examples in our tests. I believe that test.interop.ApplicationHeaders.cs does what you want.

Arnaud

falconair wrote:
Looks like I can use the following:
IMessage m = ...
...
Console.WriteLine("Message Received3: " + m.ApplicationHeaders["symbol"]);
Console.WriteLine("Message Received3: " +
m.ApplicationHeaders["symbol"].GetType());
Console.WriteLine("Message Received3: " + m.ApplicationHeaders["price"]);
Console.WriteLine("Message Received3: " +
m.ApplicationHeaders["price"].GetType());
...

Which prints the following:
Message Received3: USDEUR
Message Received3: System.String
Message Received3: 0.7551
Message Received3: System.Double

Perfect!  I now recall that one of the developers pointed this out in an
earlier message.  Perhaps this could be used in the examples as well?


falconair wrote:
Every .NET example I have seen uses code similar to the following to
retrieve messages:
...IMessage m...
BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
byte[] body = new byte[m.Body.Length - m.Body.Position];
reader.Read(body, 0, body.Length);
ASCIIEncoding enc = new ASCIIEncoding();
string message = enc.GetString(body);

Isn't there a way for me to access fields of a message using a more type
safe way:
m.getFloat("nameoffloatfield");
m.getString("nameofstringfield");

Instead of pointing out flaws, I am actually trying to write a utility
class which will let users of .NET qpid access messages through a clean
event based interface...but in order to get there I need the lower layer
to be a bit saner :)

Any quick examples of how I retrieve a couple of attributes of different
types?
Thanks



Reply via email to