qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: c++ 0.10 client, java 0.10 broker, headers exchange not routing
Date Mon, 25 Jul 2011 09:53:45 GMT
On 07/23/2011 08:46 AM, fadams wrote:
>
> Gordon Sim wrote:
>>
>> Try adding a line after that something like the following:
>>     msg.getProperties()["xyz_header"].setEncoding("utf8");
>>
>
> Is there a reason that this isn't the default behaviour

Mainly because, unlike java, in c++ std::string does not have an 
encoding it is just a sequence of chars and is at present used for both 
binary and textual data.

Now, in the case of a message property, we could perhaps take the line 
that it is unusual to send binary data as a header. (However we still 
don't know that the string is valid utf8, and I wouldn't want to be 
forced into explicitly checking that for every message).

> - it would seem to
> make sense from a Java/C++ interoperability perspective and it's not ideal
> to have to rely on a client doing something that might perhaps be seen as a
> bit esoteric.

Yes, I agree. I would certainly like to see the situation improved in 
some way. Any other thoughts/opinions/suggestions?

> In other words relying on client code rather than client
> runtime for interoperability is an unsafe principle.

(Not so sure about that.)

> This inconsistency seems to happen all over the place. For example I've just
> been bitten with qmf.opcode and qmf.agent Message properties being returned
> as byte[] - annoyingly they *mostly* get returned as String (from the broker
> agent), but when I fired up a different agent they got returned as byte[].
> This kind of breaks the JMS spec which says "The getObjectProperty method
> only returns values of class Boolean, Byte, Short, Integer, Long, Float,
> Double, and String. "
>
> In addition every string property in QMF2 from the broker agent gets
> returned as a byte[]. I've got around this by having a getStringValue method
> that does
>
> 	public String getStringValue(String name) {
> 		return hasValue(name) ? new String((byte[])getValue(name)) : "";
> 	}
>
> But I'm thinking even that's not safe as I bet if I wrote a Java Agent the
> string would be a "real" String so I'm going to have to "instanceof" which
> kind of upsets me :-)

Yes, its a little annoying

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message