That's most definitely a bug in the Perl binding. It should properly
introspect the types of keys/values just like the other bindings. If you
file a JIRA I'll see what I can do about fixing it or poking someone else
to fix it. ;-)

--Rafael


On Fri, May 16, 2014 at 11:45 AM, Fraser Adams <
fraser.ad...@blueyonder.co.uk> wrote:

> Hi Ernie,
> Messenger per se certainly supports this, the python binding introspects
> the types accurately and I'm currently writing unit tests for my JavaScript
> port to prove test the JavaScript introspection behaves correctly too, so
> if you are seeing an issue it'll be with the Perl binding and not with the
> underlying Messenger.
>
> Unfortunately I don't know Perl especially well so I can't help much other
> than to suggest that you take a look in the files
> <proton>/proton-c/bindings/perl/lib/qpid/proton/Message.pm
> <proton>/proton-c/bindings/perl/lib/qpid/proton/Data.pm
>
> The most likely place you want to look is the method preencode() in
> Message.pm, when you call $messenger->put() it'll call
> $message->preencode();
>
> Inside preencode() it's calling
>
>     $body_type->put($body, $my_body) if($my_body && $body_type);
>
> which (I think form the following code in Constants.pm
>     MAP      => qpid::proton::Mapping->new(
>         "map",
>         $cproton_perl::PN_MAP,
>         "put_map_helper",
>         "get_map_helper"),
> )
>
> results in put_map_helper in Data.pm getting called
>
> - aha!! having just "shown my working" I see the following:
>
> sub put_map_helper {
>     my ($self) = @_;
>     my ($hash) = $_[1];
>
>     $self->put_map;
>     $self->enter;
>
>     foreach(keys $hash) {
>         $self->put_string("$_");
>         $self->put_string("$hash->{$_}");
>     }
>
>     $self->exit;
> }
>
>
> I guess that the
>         $self->put_string("$_");
>         $self->put_string("$hash->{$_}");
>
> are the culprits, so it looks like the Perl binding is indeed putting
> string values for the AMQP Map values.
>
> So I'm afraid my long answer to you short question appears to be that
> Messenger per se does not have the limitation you observe, but it looks
> like the Perl binding does (if my interpretation of the code is correct) :-(
>
> Frase
>
>
>
> On 15/05/14 18:04, Ernest Allen wrote:
>
>> Does proton messenger support sending complex maps as the message body?
>> That is, maps whose values are other maps or lists and not just strings?
>>
>> When I send a message and the body is encoded as qpid::proton::MAP, the
>> map values appear to have been converted to strings.
>>
>> For example (in perl)
>>
>> In the sender
>> $msg->set_body({"foo" => 2, "bar" => [3]}, qpid::proton::MAP);
>>
>> In the receiver when I dump the body, I'm getting
>>   $VAR1 = \{
>>              'bar' => 'ARRAY(0xa2aad0)',
>>              'foo' => '2'
>>            };
>>
>> It appears that the array has been converted to the string
>> 'ARRAY(0x...)'. And the 2 is now a string '2'.
>> I don't think this is just the way the receiver is dumping the message
>> body as I'm not able to convert the results to the expected type or
>> variable.
>>
>> When I send a perl HASH instead of an array as one of the values, it is
>> coming through as the string'HASH(0x....)'.
>>
>> -Ernie
>>
>
>

Reply via email to