You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by nmittal <nm...@rblt.com> on 2009/09/01 20:02:32 UTC

Re: PERL/STOMP: MapMessages

Dejan, I have another question. Using Net::Stomp i am sending a text message
with 2 properties (one string and one Boolean). My code looks like this...

	my %head;
	$head{Critical} = 1;
	$head{Application} = "Test";
	$head{destination} = '/queue/Queue.Test';
	
	my $frame = Net::Stomp::Frame->new(
       { command => "SEND", headers => \%head, body => $message } );
	
	$stomp->send_frame($frame);

this code sends the message and I see the Text property ("Application") but
the boolean property 'Critical' is always evaluated to false. 

Thanks for your help.

Nishant



Dejan Bosanac wrote:
> 
> Try putting Jettison in your broker's classpath (lib/ or lib/optional).
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Thu, Aug 20, 2009 at 3:03 PM, nmittal <nm...@rblt.com> wrote:
> 
>>
>> I tried...
>> $stomp->subscribe(
>>      {   destination             => '/queue/Queue.Emails',
>>          'ack'                   => 'client',
>>           'activemq.prefetchSize' => 1,
>>          'transformation' => 'jms-map-json'
>>      }
>>  );
>>
>> but my client kept waiting.. however, when I do...
>>
>> $stomp->subscribe(
>>      {   destination             => '/queue/Queue.Emails',
>>          'ack'                   => 'client',
>>           'activemq.prefetchSize' => 1,
>>          'transformation' => 'jms-map-xml'
>>      }
>>  );
>>
>> the client prints the message.
>>
>> what am I doing wrong?
>>
>> thanks
>> Nishant
>>
>>
>> Dejan Bosanac wrote:
>> >
>> > Yup, you can use jms-map-xml (or json), jms-object-xml (or json) and
>> > jms-byte
>> >
>> > Cheers
>> > --
>> > Dejan Bosanac
>> >
>> > Open Source Integration - http://fusesource.com/
>> > ActiveMQ in Action - http://www.manning.com/snyder/
>> > Blog - http://www.nighttale.net
>> >
>> >
>> > On Thu, Aug 20, 2009 at 2:48 PM, nmittal <nm...@rblt.com> wrote:
>> >
>> >>
>> >> That was it, I wasnt using any transformation. Now i see the body as
>> >> XML..
>> >> thanks a lot Dejan. Also, is there a jms-map-json?
>> >>
>> >> thanks again
>> >> Nishant
>> >>
>> >>
>> >> Dejan Bosanac wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > I'm not sure your Perl client supports messages transformation, but
>> you
>> >> > have
>> >> > to add "transformation" header to your subscribe frame (such as
>> >> > 'transformation' => 'jms-map-xml').
>> >> >
>> >> > Take a look at
>> >> > http://activemq.apache.org/stomp.html#Stomp-Messagetransformations
>> >> > and StompTest unit test for more info and examples on the topic.
>> >> >
>> >> > But as I said, your Stomp client must play along as well.
>> >> >
>> >> > Cheers
>> >> > --
>> >> > Dejan Bosanac
>> >> >
>> >> > Open Source Integration - http://fusesource.com/
>> >> > ActiveMQ in Action - http://www.manning.com/snyder/
>> >> > Blog - http://www.nighttale.net
>> >> >
>> >> >
>> >> > On Wed, Aug 19, 2009 at 7:25 PM, nmittal <nm...@rblt.com> wrote:
>> >> >
>> >> >>
>> >> >> Hi, Has anyone been able to write a Perl client that reads
>> MapMessges
>> >> off
>> >> >> of
>> >> >> an ActiveMQ queue?
>> >> >>
>> >> >> We have a C++ ActiveMQ client that is sending MapMessages to the
>> >> broker.
>> >> >> However, the Perl client using Net::Stomp says that the body is
>> >> >> undefined.
>> >> >> Below is the message as seen in the activemq admin web interface…
>> >> >>
>> >> >> {msg=<table cellpadding=5 cellspacing=0><tr><td colspan=4
>> >> align=center>At
>> >> >> 2009-08-19 08:21:41</td></tr><tr style="background-color:Blue;
>> >> >> color:White;
>> >> >> font-weight:bold"><td style="font-weight: bold"
>> >> >> align="right"></td><td>Avg
>> >> >> ticks/sec</td><td>Max ticks/sec</td><td>Total
>> ticks</td></tr><tr><td
>> >> >> style="font-weight: bold" align="right">Last 15 minutes</td><td
>> >> >> align="right">30</td><td align="right">68</td><td
>> >> >> align="right">26661</td></tr><tr><td style="font-weight: bold"
>> >> >> align="right">Today</td><td align="right">6</td><td
>> >> >> align="right">177</td><td align="right">177790</td></tr></table>,
>> >> >> email=nmittal@rblt.com, subject=RSIGrid: FeedHandler Tick Update}
>> >> >>
>> >> >> My perl code is …
>> >> >> #!/usr/bin/perl -w
>> >> >>
>> >> >> use strict;
>> >> >> use Net::Stomp;
>> >> >>
>> >> >>
>> >> >> my $broker = defined($ARGV[0])? $ARGV[0] : "localhost";
>> >> >>
>> >> >> my $stomp = Net::Stomp->new( { hostname => $broker, port => '61613'
>> }
>> >> );
>> >> >> $stomp->connect();
>> >> >> $stomp->subscribe(
>> >> >>      {   destination             => '/queue/Queue.Emails',
>> >> >>          'ack'                   => 'client',
>> >> >>          'activemq.prefetchSize' => 1
>> >> >>      }
>> >> >>  );
>> >> >>
>> >> >> while (1) {
>> >> >>    my $frame = $stomp->receive_frame;
>> >> >>    print $frame->body;
>> >> >> #    $stomp->ack( { frame => $frame } );
>> >> >> }
>> >> >> $stomp->disconnect;
>> >> >>
>> >> >> The output of the above program is…
>> >> >> $ ./emailer.pl
>> >> >> Use of uninitialized value in print at ./emailer.pl line 20, <GEN0>
>> >> line
>> >> >> 12.
>> >> >>
>> >> >> Any help on this is appreciated.
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25048522.html
>> >> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > -----
>> >> > Dejan Bosanac
>> >> >
>> >> > Open Source Integration - http://fusesource.com/
>> >> > ActiveMQ in Action - http://www.manning.com/snyder/
>> >> > Blog - http://www.nighttale.net
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25061359.html
>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > -----
>> > Dejan Bosanac
>> >
>> > Open Source Integration - http://fusesource.com/
>> > ActiveMQ in Action - http://www.manning.com/snyder/
>> > Blog - http://www.nighttale.net
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25061617.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25244067.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: PERL/STOMP: MapMessages

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Nishant,

Stomp 1.0 supports only string headers, so it's probably something with the
conversion that gets you always a false value. Currently you have to do your
own conversions from string to the type you want to use. This is something
we are looking to improve in Stomp 1.1 spec.

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Sep 1, 2009 at 8:02 PM, nmittal <nm...@rblt.com> wrote:

>
> Dejan, I have another question. Using Net::Stomp i am sending a text
> message
> with 2 properties (one string and one Boolean). My code looks like this...
>
>        my %head;
>        $head{Critical} = 1;
>        $head{Application} = "Test";
>        $head{destination} = '/queue/Queue.Test';
>
>        my $frame = Net::Stomp::Frame->new(
>       { command => "SEND", headers => \%head, body => $message } );
>
>        $stomp->send_frame($frame);
>
> this code sends the message and I see the Text property ("Application") but
> the boolean property 'Critical' is always evaluated to false.
>
> Thanks for your help.
>
> Nishant
>
>
>
> Dejan Bosanac wrote:
> >
> > Try putting Jettison in your broker's classpath (lib/ or lib/optional).
> >
> > Cheers
> > --
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Aug 20, 2009 at 3:03 PM, nmittal <nm...@rblt.com> wrote:
> >
> >>
> >> I tried...
> >> $stomp->subscribe(
> >>      {   destination             => '/queue/Queue.Emails',
> >>          'ack'                   => 'client',
> >>           'activemq.prefetchSize' => 1,
> >>          'transformation' => 'jms-map-json'
> >>      }
> >>  );
> >>
> >> but my client kept waiting.. however, when I do...
> >>
> >> $stomp->subscribe(
> >>      {   destination             => '/queue/Queue.Emails',
> >>          'ack'                   => 'client',
> >>           'activemq.prefetchSize' => 1,
> >>          'transformation' => 'jms-map-xml'
> >>      }
> >>  );
> >>
> >> the client prints the message.
> >>
> >> what am I doing wrong?
> >>
> >> thanks
> >> Nishant
> >>
> >>
> >> Dejan Bosanac wrote:
> >> >
> >> > Yup, you can use jms-map-xml (or json), jms-object-xml (or json) and
> >> > jms-byte
> >> >
> >> > Cheers
> >> > --
> >> > Dejan Bosanac
> >> >
> >> > Open Source Integration - http://fusesource.com/
> >> > ActiveMQ in Action - http://www.manning.com/snyder/
> >> > Blog - http://www.nighttale.net
> >> >
> >> >
> >> > On Thu, Aug 20, 2009 at 2:48 PM, nmittal <nm...@rblt.com> wrote:
> >> >
> >> >>
> >> >> That was it, I wasnt using any transformation. Now i see the body as
> >> >> XML..
> >> >> thanks a lot Dejan. Also, is there a jms-map-json?
> >> >>
> >> >> thanks again
> >> >> Nishant
> >> >>
> >> >>
> >> >> Dejan Bosanac wrote:
> >> >> >
> >> >> > Hi,
> >> >> >
> >> >> > I'm not sure your Perl client supports messages transformation, but
> >> you
> >> >> > have
> >> >> > to add "transformation" header to your subscribe frame (such as
> >> >> > 'transformation' => 'jms-map-xml').
> >> >> >
> >> >> > Take a look at
> >> >> > http://activemq.apache.org/stomp.html#Stomp-Messagetransformations
> >> >> > and StompTest unit test for more info and examples on the topic.
> >> >> >
> >> >> > But as I said, your Stomp client must play along as well.
> >> >> >
> >> >> > Cheers
> >> >> > --
> >> >> > Dejan Bosanac
> >> >> >
> >> >> > Open Source Integration - http://fusesource.com/
> >> >> > ActiveMQ in Action - http://www.manning.com/snyder/
> >> >> > Blog - http://www.nighttale.net
> >> >> >
> >> >> >
> >> >> > On Wed, Aug 19, 2009 at 7:25 PM, nmittal <nm...@rblt.com> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hi, Has anyone been able to write a Perl client that reads
> >> MapMessges
> >> >> off
> >> >> >> of
> >> >> >> an ActiveMQ queue?
> >> >> >>
> >> >> >> We have a C++ ActiveMQ client that is sending MapMessages to the
> >> >> broker.
> >> >> >> However, the Perl client using Net::Stomp says that the body is
> >> >> >> undefined.
> >> >> >> Below is the message as seen in the activemq admin web interface…
> >> >> >>
> >> >> >> {msg=<table cellpadding=5 cellspacing=0><tr><td colspan=4
> >> >> align=center>At
> >> >> >> 2009-08-19 08:21:41</td></tr><tr style="background-color:Blue;
> >> >> >> color:White;
> >> >> >> font-weight:bold"><td style="font-weight: bold"
> >> >> >> align="right"></td><td>Avg
> >> >> >> ticks/sec</td><td>Max ticks/sec</td><td>Total
> >> ticks</td></tr><tr><td
> >> >> >> style="font-weight: bold" align="right">Last 15 minutes</td><td
> >> >> >> align="right">30</td><td align="right">68</td><td
> >> >> >> align="right">26661</td></tr><tr><td style="font-weight: bold"
> >> >> >> align="right">Today</td><td align="right">6</td><td
> >> >> >> align="right">177</td><td align="right">177790</td></tr></table>,
> >> >> >> email=nmittal@rblt.com, subject=RSIGrid: FeedHandler Tick Update}
> >> >> >>
> >> >> >> My perl code is …
> >> >> >> #!/usr/bin/perl -w
> >> >> >>
> >> >> >> use strict;
> >> >> >> use Net::Stomp;
> >> >> >>
> >> >> >>
> >> >> >> my $broker = defined($ARGV[0])? $ARGV[0] : "localhost";
> >> >> >>
> >> >> >> my $stomp = Net::Stomp->new( { hostname => $broker, port =>
> '61613'
> >> }
> >> >> );
> >> >> >> $stomp->connect();
> >> >> >> $stomp->subscribe(
> >> >> >>      {   destination             => '/queue/Queue.Emails',
> >> >> >>          'ack'                   => 'client',
> >> >> >>          'activemq.prefetchSize' => 1
> >> >> >>      }
> >> >> >>  );
> >> >> >>
> >> >> >> while (1) {
> >> >> >>    my $frame = $stomp->receive_frame;
> >> >> >>    print $frame->body;
> >> >> >> #    $stomp->ack( { frame => $frame } );
> >> >> >> }
> >> >> >> $stomp->disconnect;
> >> >> >>
> >> >> >> The output of the above program is…
> >> >> >> $ ./emailer.pl
> >> >> >> Use of uninitialized value in print at ./emailer.pl line 20,
> <GEN0>
> >> >> line
> >> >> >> 12.
> >> >> >>
> >> >> >> Any help on this is appreciated.
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> >>
> >>
> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25048522.html
> >> >> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > -----
> >> >> > Dejan Bosanac
> >> >> >
> >> >> > Open Source Integration - http://fusesource.com/
> >> >> > ActiveMQ in Action - http://www.manning.com/snyder/
> >> >> > Blog - http://www.nighttale.net
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25061359.html
> >> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > -----
> >> > Dejan Bosanac
> >> >
> >> > Open Source Integration - http://fusesource.com/
> >> > ActiveMQ in Action - http://www.manning.com/snyder/
> >> > Blog - http://www.nighttale.net
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25061617.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > -----
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
>
> --
> View this message in context:
> http://www.nabble.com/PERL-STOMP%3A-MapMessages-tp25048522p25244067.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>