string or stream?

  • Thread starter Thread starter Daniel Bass
  • Start date Start date
D

Daniel Bass

I'm creating a routing application that uses both MSMQ and IBMMQ message
queues as a requirement.

When retrieving a message off an MSMQ, I ask for the message body stream to
get the message data, but when I reference messages coming off an IBM MQ
series queue, I receive a string.

Now all messages pulled off are processed the same, regardless of the queue,
hence the need to either convert and Stream objects into strings, and pass
strings everywhere, or use Stream objects everywhere, where any strings I've
come across are converted to a Stream.

Are there any size restrictions on either that would move me towards the
other? Messages may be quite large (50kb as a wild guess).

Would you recommend the Stream object or the String??? Why?

Thanks!!!
Dan.
 
Daniel Bass said:
I'm creating a routing application that uses both MSMQ and IBMMQ message
queues as a requirement.

When retrieving a message off an MSMQ, I ask for the message body stream to
get the message data, but when I reference messages coming off an IBM MQ
series queue, I receive a string.

Now all messages pulled off are processed the same, regardless of the queue,
hence the need to either convert and Stream objects into strings, and pass
strings everywhere, or use Stream objects everywhere, where any strings I've
come across are converted to a Stream.

Are there any size restrictions on either that would move me towards the
other? Messages may be quite large (50kb as a wild guess).

Would you recommend the Stream object or the String??? Why?

It mostly depends on whether the whole messages is representable as
text. If so, I'd use a string - it's a lot easier to deal with in
general, although (depending on the encoding) it'll take up more
memory.

Hoewver, if you need binary data (as real binary, rather than encoded
binary such as base64) then you really can't make do with strings.
 
Jon,

Thanks buddy.
Everything that's coming in is either XML or SAP's idoc, so I'll stick with
string.

Dan.

Daniel Bass said:
I'm creating a routing application that uses both MSMQ and IBMMQ message
queues as a requirement.

When retrieving a message off an MSMQ, I ask for the message body stream to
get the message data, but when I reference messages coming off an IBM MQ
series queue, I receive a string.

Now all messages pulled off are processed the same, regardless of the queue,
hence the need to either convert and Stream objects into strings, and pass
strings everywhere, or use Stream objects everywhere, where any strings I've
come across are converted to a Stream.

Are there any size restrictions on either that would move me towards the
other? Messages may be quite large (50kb as a wild guess).

Would you recommend the Stream object or the String??? Why?

It mostly depends on whether the whole messages is representable as
text. If so, I'd use a string - it's a lot easier to deal with in
general, although (depending on the encoding) it'll take up more
memory.

Hoewver, if you need binary data (as real binary, rather than encoded
binary such as base64) then you really can't make do with strings.
 
Back
Top