Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from __future__ import absolute_import, division, print_function, unicode_literals
  4.  
  5. # gevent
  6. from gevent import sleep
  7.  
  8. # Zato
  9. from zato.common.broker_message import SERVICE
  10. from zato.common.util import new_cid
  11. from zato.server.service import Service
  12.  
  13. class EnforceAutoSQLPing(Service):
  14. name = 'enforce.auto.sql.ping'
  15.  
  16. def handle(self):
  17.  
  18. while True:
  19.  
  20. msg = {
  21. 'action': SERVICE.PUBLISH.value,
  22. 'service': 'zato.outgoing.sql.auto-ping',
  23. 'payload': 'My payload',
  24. 'cid': new_cid()
  25. }
  26. self.broker_client.publish(msg)
  27.  
  28. # Wait half a minute before pinging again
  29. sleep(30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement