You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by ngcdan12 <ga...@hotmail.com> on 2009/11/02 19:31:12 UTC

Re: MapMessages from Python to Java

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.


Re: MapMessages from Python to Java

Posted by ngcdan12 <ga...@hotmail.com>.
Great thanks for the help.

I can send and receive messages from python to java now :).

Dan


James Casey-2 wrote:
> 
> 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 <ga...@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.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/MapMessages-from-Python-to-Java-tp26070536p26205924.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: MapMessages from Python to Java

Posted by James Casey <ja...@gmail.com>.
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 <ga...@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.
>
>