string or stream?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Bass

    string or stream?

    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.



  • Jon Skeet [C# MVP]

    #2
    Re: string or stream?

    Daniel Bass <danielbass@NOS PAMpostmaster.c o.uk> wrote:[color=blue]
    > 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?[/color]

    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 Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Daniel Bass

      #3
      Re: string or stream?

      Jon,

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

      Dan.

      "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
      news:MPG.19ef67 9482f9bfe798983 7@msnews.micros oft.com...
      Daniel Bass <danielbass@NOS PAMpostmaster.c o.uk> wrote:[color=blue]
      > 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[/color]
      to[color=blue]
      > 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[/color]
      queue,[color=blue]
      > hence the need to either convert and Stream objects into strings, and pass
      > strings everywhere, or use Stream objects everywhere, where any strings[/color]
      I've[color=blue]
      > 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?[/color]

      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 Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too


      Comment

      Working...