Beispiel #1
0
# encoding: utf-8
#  my_send.py
import time
import ztq_core
import transaction
from ztq_demo.tasks import send

ztq_core.setup_redis('default','localhost', 6379, 3)

ztq_core.enable_transaction(True)

send('transaction send 1')
send('transaction send 2')

send('no transaction msg show first', ztq_transaction=False)

print 'send, waitting for commit'
time.sleep(5)

transaction.commit()
print 'committed'

Beispiel #2
0
# encoding: utf-8
#  my_send.py
import time
import ztq_core
import transaction
from ztq_demo.tasks import send, send_failed, failed_callback

ztq_core.setup_redis('default', 'localhost', 6379, 3)

callback = ztq_core.prepare_task(send, 'succeed!', ztq_queue='mail')
fcallback = ztq_core.prepare_task(failed_callback)

send('send a good msg, see what?',
     ztq_queue='mail',
     ztq_callback=callback,
     ztq_fcallback=fcallback)

send_failed('send a failed msg, see what?',
            ztq_callback=callback,
            ztq_fcallback=fcallback)
Beispiel #3
0
# encoding: utf-8
#  my_send.py
import time
import ztq_core
import transaction
from ztq_demo.tasks import send

ztq_core.setup_redis('default','localhost', 6379, 3)

callback = ztq_core.prepare_task(send, 'yes, callback!!')
send('see callback?', ztq_callback=callback)

Beispiel #4
0
import time
import ztq_core
from ztq_demo.tasks import send

ztq_core.setup_redis('default','localhost', 6379, 3)

send('hello, world 1')
send('hello, world 2')
send('hello, world 3')

send('hello, world 4', ztq_queue='mail')
Beispiel #5
0
import time
import ztq_core
from ztq_demo.tasks import send

ztq_core.setup_redis('default','localhost', 6379, 3)

send('hello, world 1')
send('hello, world 2')

print 'hello, world 1:'
import pdb; pdb.set_trace()
print ztq_core.ping_task(send, 'hello, world 1')
print 'hello, world 2:'
print ztq_core.ping_task(send, 'hello, world 2')
Beispiel #6
0
# encoding: utf-8
#  my_send.py
import time
import ztq_core
import transaction
from ztq_demo.tasks import send, send_failed, failed_callback

ztq_core.setup_redis('default','localhost', 6379, 3)

callback = ztq_core.prepare_task(send, 'succeed!', ztq_queue='mail')
fcallback = ztq_core.prepare_task(failed_callback)

send('send a good msg, see what?', 
		ztq_queue= 'mail',
		ztq_callback=callback,
		ztq_fcallback=fcallback)

send_failed('send a failed msg, see what?', 
		ztq_callback=callback,
		ztq_fcallback=fcallback)

Beispiel #7
0
# encoding: utf-8
#  my_send.py
import time
import ztq_core
import transaction
from ztq_demo.tasks import send

ztq_core.setup_redis('default', 'localhost', 6379, 3)

ztq_core.enable_transaction(True)

send('transaction send 1')
send('transaction send 2')

send('no transaction msg show first', ztq_transaction=False)

print 'send, waitting for commit'
time.sleep(5)

transaction.commit()
print 'committed'