Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-6665

update hello_world.cpp example to use setContentObject

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • qpid-cpp-0.34
    • qpid-cpp-1.35.0
    • C++ Client, C++ Examples
    • None

    Description

      The hello_world.cpp example for Qpid Messaging C++ currently sends its
      message by doing "sender.send(Message("Hello world!"));" which causes
      it to send a 'data' body section containing the bytes when using AMQP
      1.0.

      Aleternatively, doing the following results in the payload sent by the client changing to an 'amqp-value' body section containing a utf8 string:

          Message msg;
          msg.setContentObject("Hello World!");
          msg.getContentObject().setEncoding("utf8");
          sender.send(msg);
      

      The latter is probably more in line with expectation of sending a string, and less likely to confuse when interoperating with other clients, and the other examples already do this for string content so the hellow world example should be updated to match.

      Attachments

        Activity

          People

            robbie Robbie Gemmell
            robbie Robbie Gemmell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: