Skip to content

Instantly share code, notes, and snippets.

@dsuch
Created November 26, 2015 16:46
Show Gist options
  • Save dsuch/2599ac624460ce76ad11 to your computer and use it in GitHub Desktop.
Save dsuch/2599ac624460ce76ad11 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# gevent
from gevent import sleep
# Zato
from zato.common.broker_message import SERVICE
from zato.common.util import new_cid
from zato.server.service import Service
class EnforceAutoSQLPing(Service):
name = 'enforce.auto.sql.ping'
def handle(self):
while True:
msg = {
'action': SERVICE.PUBLISH.value,
'service': 'zato.outgoing.sql.auto-ping',
'payload': 'My payload',
'cid': new_cid()
}
self.broker_client.publish(msg)
# Wait half a minute before pinging again
sleep(30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment