You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Gordon Sim (JIRA)" <ji...@apache.org> on 2014/08/05 10:19:13 UTC

[jira] [Commented] (QPID-5961) C++ Messaging setContentObject(map) leaves broken message

    [ https://issues.apache.org/jira/browse/QPID-5961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14085984#comment-14085984 ] 

Gordon Sim commented on QPID-5961:
----------------------------------

My own view is that this is not a bug. The intent is that an application uses either the raw content or the content object, but not both. There is no automatic conversion between these on the sending side. On the receiving side you can use either one, regardless of how the message was sent.

I'm by no means opposed to a fix, but I think it will not be totally trivial to do right.


> C++ Messaging setContentObject(map) leaves broken message
> ---------------------------------------------------------
>
>                 Key: QPID-5961
>                 URL: https://issues.apache.org/jira/browse/QPID-5961
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Client
>    Affects Versions: 0.28
>         Environment: C++ trunk build
>            Reporter: Chuck Rolke
>
> The Messaging function Message.setContentObject(someMap) fails to completely set the message. After this call the message.getContent() returns a blank even though the message holds a map.
> Modifying the examples\messaging\map_sender.cpp to:
> {noformat}
> Message message;
> Variant::Map content;
> content["id"] = 987654321;
> content["name"] = "Widget";
> content["percent"] = 0.99;
> Variant::List colours;
> colours.push_back(Variant("red"));
> colours.push_back(Variant("green"));
> colours.push_back(Variant("white"));
> content["colours"] = colours;
> content["uuid"] = Uuid(true);
> message.setContentObject(content);
> std::cout << "Step 1. Where's the data?(fail)" << std::endl
>     << "message.getContent(): " << std::endl
>     << message.getContent() << std::endl;
> Variant dataOut;
> dataOut = message.getContentObject();
> std::cout << "Step 2. Retrieve the map and print it (ok)." << std::endl
>     << "dataOut.asString(): " << std::endl
>     <<  dataOut.asString() << std::endl;
> Message message2((Variant)content);
> std::cout << "Step 3. Create a new message from original map (ok)" << std::endl
>     << "message2.getContent(): " << std::endl
>     <<  message2.getContent() << std::endl;
> {noformat}
> Produces this output:
> {noformat}
> Step 1. Where's the data?(fail)
> message.getContent():
> Step 2. Retrieve the map and print it (ok).
> dataOut.asString():
> {colours:[red, green, white], id:987654321, name:Widget, percent:0.9899999999999
> 9999, uuid:c4c602f9-d523-4711-8c4d-dad5330ddab4}
> Step 3. Create a new message from original map (ok)
> message2.getContent():
> {colours:[red, green, white], id:987654321, name:Widget, percent:0.9899999999999
> 9999, uuid:c4c602f9-d523-4711-8c4d-dad5330ddab4}
> {noformat}
> The issue is that Step 1 produces no outupt. Step 2 retrieves the map from the message and prints that OK. Step 3 constructs a new message from the map and the prints normally.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org