My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Examples  
Examples of using pyactivemq.
Updated Oct 5, 2008 by fullung@gmail.com

Sending pickled Python objects

This example shows how to send pickled Python objects (in this case, NumPy arrays).

http://code.google.com/p/pyactivemq/source/browse/trunk/src/examples/numpypickle.py

Expected output:

pickled 1000 arrays, each 80000 bytes, in 4.179399 seconds (18.2548 MiB/s)

Asynchronous message listener

The latest code in trunk supports asynchronous message listeners.

http://code.google.com/p/pyactivemq/source/browse/trunk/src/examples/asynclistener.py

Expected output (varies due to the threads associated with consumers):

consumer0 got: hello0
consumer1 got: hello0
consumer2 got: hello0
consumer0 got: hello1
consumer2 got: hello1
consumer1 got: hello1
...
consumer0 got: hello97
consumer0 got: hello98
consumer0 got: hello99

Durable subscription

This example corresponds to the DurableSubscriberExample.java described in the Java EE 5 Tutorial in Chapter 31 under Creating Robust JMS Applications.

http://code.google.com/p/pyactivemq/source/browse/trunk/src/examples/DurableSubscriberExample.py

Expected output:

Starting subscriber
PUBLISHER: Publishing message: Here is a message 1
PUBLISHER: Publishing message: Here is a message 2
PUBLISHER: Publishing message: Here is a message 3
SUBSCRIBER: Reading Message: Here is a message 1
SUBSCRIBER: Reading Message: Here is a message 2
SUBSCRIBER: Reading Message: Here is a message 3
Closing subscriber
PUBLISHER: Publishing message: Here is a message 4
PUBLISHER: Publishing message: Here is a message 5
PUBLISHER: Publishing message: Here is a message 6
Starting subscriber
SUBSCRIBER: Reading Message: Here is a message 4
SUBSCRIBER: Reading Message: Here is a message 5
SUBSCRIBER: Reading Message: Here is a message 6
Closing subscriber
Comment by vsaldarr...@gmail.com, Mar 26, 2009

Do you have samples of twisted integration?

Comment by vsaldarr...@gmail.com, Mar 26, 2009

I built version 0.1.0 with activemq-2.2.5, python 2.5 and apr-1.3.3 and the built went ok. When I try to import pyactivemq ... I get undefined symbol: PyUnicodeUCS4_FromEncodedObject?

BTW: python 2.4 works.

Comment by project member fullung@gmail.com, Aug 5, 2009

What kind of Twisted integration example would you like to see?

Comment by sebastie...@gmail.com, Nov 12, 2009

Tried the asynclistener example with pyactivemq-0.1.0, activemq-cpp-2.2.1 and libboost-python1.38.0 on the ubuntu 9.10 and I got the following error :

Traceback (most recent call last):

File "gn_events_pyactivemq.py", line 38, in <module>
listener = MessageListener?('consumer%d' % i, queue)
Boost.Python.ArgumentError?: Python argument types in
MessageListener?.init(MessageListener?, str, instance)
did not match C++ signature:
init(object)

Any idea?


Sign in to add a comment
Powered by Google Project Hosting