[rabbitmq-discuss] properties.headers in Perl client

vickerto vickerto at gmail.com
Wed Dec 22 19:55:05 GMT 2010


I just looked through RabbitFoot again and it appears that, just like
Net::RabbitMQ, you can't actually set the 'headers' property of the
message headers.  Looking at the code that it uses to create the
header:

sub _header {
    my ($self, $args, $body,) = @_;

    $self->{connection}->_push_write(
        Net::AMQP::Frame::Header->new(
            weight => $args->{weight} || 0,
            body_size => length($body),
            header_frame => Net::AMQP::Protocol::Basic::ContentHeader-
>new(
                content_type => 'application/octet-stream',
                content_encoding => '',
                headers => {},
                delivery_mode => 1,
                priority => 1,
                correlation_id => '',
                expiration => '',
                message_id => '',
                timestamp => time,
                type => '',
                user_id => '',
                app_id => '',
                cluster_id => '',
                %$args,
            ),
        ),
        $self->{id},
    );

    return $self;
}

The 'headers => {}' is the problem.  I need to be able to set this to
my own key/value array, but none of the clients that I have found
actually allow for this.  I can modify it to accept a new argument,
but I was hoping to find a client that I could use out of the box.



On Dec 21, 5:24 pm, Christian Legnitto <clegni... at mozilla.com> wrote:
> Net::RabbitFoot lets you set the headers as well. Take a look at how I do it @https://github.com/LegNeato/bugzilla-push/blob/master/Push/lib/Backen...(though I am not sure I actually pass any headers anywhere for that backend).
>
> The code in RabbitFoot is @https://github.com/cooldaemon/RabbitFoot/blob/master/lib/AnyEvent/Rab...
>
> Thanks,
> Christian
>
> On Dec 21, 2010, at 12:51 PM, vickerto wrote:
>
>
>
> > Awesome, thanks!  I'll take a look.
>
> > On Dec 21, 1:47 pm, Emile Joubert <em... at rabbitmq.com> wrote:
> >> Hi vickerto,
>
> >> I can confirm that POE::Component::Client::AMQP (by Eric Waters) lets
> >> you set headers. This works for me:
>
> >>      $queue->publish($msg,
> >>        {
> >>          headers => { 'key' => 'value'}
> >>        }
> >>      );
>
> >> Regards
>
> >> Emile
>
> >> Op 21/12/2010 20:11, het vickerto geskryf:
>
> >>>  From what I've seen, most of them just set the headers to an empty
> >>> AMQP table with no way of setting them.  I'm taking a look at possibly
> >>> updating Net::RabbitMQ (which uses librabbitmq) to accept the headers
> >>> and process them, but I'm going to have to dust off the part of my
> >>> brain that contains my knowledge of Perl and C :)
>
> >>> On Dec 21, 12:41 pm, David Wragg<da... at rabbitmq.com>  wrote:
> >>>> Hi Tom,
>
> >>>> vickerto<vicke... at gmail.com>  writes:
> >>>>> I have successfully implemented a messaging system using one of the
> >>>>> PHP clients that I found on the web.  I am currently working on a Perl
> >>>>> counterpart that can send and receive messages to/from the same
> >>>>> system.
>
> >>>>> The problem that I am running into is that I was successfully able to
> >>>>> use the properties.headers to store some key/value information about
> >>>>> my message in the PHP client, but I have yet to find a Perl client
> >>>>> that actually supports or uses these headers.  Am I missing something
> >>>>> or does nobody actually use these headers in Perl?
>
> >>>> Not all AMQP applications use the message headers, so it's plausible
> >>>> that no-one has yet bothered to add support to the Perl clients.  Though
> >>>> it would be a fairly significant omission, given that the headers are
> >>>> (potentially) a part of every AMQP message.  I'm not aware of other
> >>>> clients that take this short cut.
>
> >>>> David
>
> >> _______________________________________________
> >> rabbitmq-discuss mailing list
> >> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-disc... at lists.rabbitmq.com
> >https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


More information about the rabbitmq-discuss mailing list