activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dejan Bosanac <de...@nighttale.net>
Subject Re: MapMessages from Python to Java
Date Fri, 30 Oct 2009 11:36:49 GMT
James,

thanks for great example. Shouldn't it be jms-map-json in this example
however?

Dan, you can also take a look at PHP example here
http://stomp.fusesource.org/documentation/php/book.html#_message_transformation

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

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


On Fri, Oct 30, 2009 at 11:26 AM, James Casey <jamesc.000@gmail.com> wrote:

> Hi Dan,
>
> for stomp.py, here's the code snippet to do what you need to do:
>
>    dest='/queue/test.foo'
>    conn = stomp.Connection([(HOST,PORT)])
>    conn.start()
>    conn.connect()
>    message = {'field1' : 'foo', 'field2' : 'bar'}
>
>    conn.send(message, destination=dest, headers={'transformation' :
> 'jms-map-xml'}, ack='auto')
>    conn.disconnect()
>
> Note we pass in a dict as the payload, along with the transformation
> type 'jms-map-xml'.
>
> cheers,
>
> James.
>
>
> 2009/10/30 ngcdan12 <gameoperative2@hotmail.com>:
> >
> > Hello Dejan,
> >
> > Python is sending mapmessages directly to the MQ server :).
> >
> > I am wondering about the Stomp protocol.  The example you listed below is
> > for a Java implementaion of Stomp.  I am actually having a problem with
> the
> > MapMessage being sent from the Python side.  So I would need to convert
> the
> > mapmessage to an xml object, then, using stomp headers convert that
> object
> > to a map message then send it correct?  The problem is I need to do that
> in
> > Python and have been unable to find how to do so since all the examples
> are
> > listed in java.  Could you clarify on using Python to create an xml
> object,
> > convert to a map message then send it to Java?  Or is that not possible.
>  I
> > have been looking at some modules like Stompy and stomppy but have not
> been
> > able to create a working messageListener.
> >
> > Thanks,
> >
> > Dan
> >
> >
> > Hi,
> >
> > are you sure you're sending map messages from Python?
> >
> > If you use Stomp protocol, you have to send your data xml or json encoded
> > and use "transformation" header to specify how data should be converted
> to
> > Java. I suggest you read this
> >
> http://cwiki.apache.org/confluence/display/ACTIVEMQ/Stomp#Stomp-Messagetransformationsand
> > look at StompTest (
> >
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?view=markup
> )
> > for some more examples.
> >
> > You can also use py-activemq (http://code.google.com/p/pyactivemq/) lib
> > which can use OpenWire and CMS API to send map messages naturally.
> >
> > Cheers
> > --
> > Dejan Bosanac - http://twitter.com/dejanb
> >
> > 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/MapMessages-from-Python-to-Java-tp26070536p26123324.html
> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message