activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Casey <jamesc....@gmail.com>
Subject Re: MapMessages from Python to Java
Date Fri, 30 Oct 2009 10:26:17 GMT
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
View raw message