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 Mon, 02 Nov 2009 20:07:13 GMT
Hi Dan,

The code should look like :

import stomp

dest='/queue/MQ-X.1234.X-1.RadarTracks'
     # [1]
conn = stomp.Connection([('localhost',61616)])
       # [2]
conn.start()
conn.connect()
message = {'field1' : 'foo', 'field2' : 'bar'}

conn.send(message, destination=dest, headers={'transformation' :
   'jms-map-xml'}, ack='auto')
conn.disconnect()

Note:
[1] For STOMP you need to specific '/topic' or '/queue' as appropriate
in the destination

[2] You only need to specify 'localhost', no need for a full URL

For the logging warning, check what version of stomp.py you're using -
the issue with the logger is fixed in more recent versions (e.g.
2.0.4)

Finally, note that you can have your java consumer listen via openwire
and your python producer send via STOMP, you just need to add 2
network connectors (normally 'tcp://' connector is on port 61616 and
'stomp://' connector is on port 61613.

cheers,

James.

2009/11/2 ngcdan12 <gameoperative2@hotmail.com>:
>
> Hey guys,
>
> Thanks for the response.  I made a Python script with the above code.
>
> import stomp
>
> dest='MQ-X.1234.X-1.RadarTracks'
> conn = stomp.Connection([('stomp:\\localhost',61616)])
> conn.start()
> conn.connect()
> message = {'field1' : 'foo', 'field2' : 'bar'}
>
> conn.send(message, destination=dest, headers={'transformation' :
>    'jms-map-xml'}, ack='auto')
> conn.disconnect()
>
> When I run this script I get a
> No handlers could be found for logger "stomp.py", warning message/error.
>
> I do not seem to be receiving any messages from my java message listener
> either.  Is this an error I should be worried about?  Also on my java
> listener I put the url as "stomp://localhost:61616"; which seems to run ok.
> I then connect to the broker using ActiveMQConnectionFactory class. I had to
> also enable the Stomp connector in the activemq.xml file stored in the
> activemq directory, by adding
> <transportConnector name="stomp" uri="stomp://localhost:61616"/>
>
> Thanks,
>
> Dan
> --
> View this message in context: http://old.nabble.com/MapMessages-from-Python-to-Java-tp26070536p26157767.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Mime
View raw message