def watchAzureQueue(): global Counter if AZURE_RECEIVING == False: return bus_service = ServiceBusService( service_namespace='msgtestsb', shared_access_key_name='RootManageSharedAccessKey', shared_access_key_value='Ar9fUCZQdTL7cVWgerdNOB7sbQp0cWEeQyTRYUjKwpk=') queue_options = Queue() queue_options.max_size_in_megabytes = '5120' queue_options.default_message_time_to_live = 'PT96H' bus_service.create_queue('process_incoming', queue_options) bus_service.create_queue('whatsapp_sender', queue_options) while not isfile('/home/bitnami1/whatsapp/.stopwhatsapp') and Counter > 1: msg = bus_service.receive_queue_message('whatsapp_sender', peek_lock=False) if msg != None and msg.body: logging.info('%s ' % datetime.now() + msg.body) SendQueue.put(msg.body) else: logging.info('%s ' % datetime.now() + "Empty Azure Queue") time.sleep(4.6)
def watchWhatsApp(): global Counter while not isfile('/home/bitnami1/whatsapp/.stopwhatsapp') and Counter > 0: logging.info( '%s counter:%s' % (datetime.now(), Counter) + ": Sleeping now") if SendQueue.empty(): time.sleep(1.6) stack = YowsupEchoStack(credentials, True) stack.start() Counter -= 1
def watchWhatsApp(): global Counter while not isfile('/home/bitnami1/whatsapp/.stopwhatsapp') and Counter > 0: logging.info('%s counter:%s' % (datetime.now(), Counter) + ": Sleeping now") if SendQueue.empty(): time.sleep(1.6) stack = YowsupEchoStack(credentials, True) stack.start() Counter -= 1
def watchAzureQueue(): global Counter if AZURE_RECEIVING == False: return bus_service = ServiceBusService( service_namespace='msgtestsb', shared_access_key_name='RootManageSharedAccessKey', shared_access_key_value='Ar9fUCZQdTL7cVWgerdNOB7sbQp0cWEeQyTRYUjKwpk=') queue_options = Queue() queue_options.max_size_in_megabytes = '5120' queue_options.default_message_time_to_live = 'PT96H' bus_service.create_queue('process_incoming', queue_options) bus_service.create_queue('whatsapp_sender', queue_options) while not isfile('/home/bitnami1/whatsapp/.stopwhatsapp') and Counter > 1: msg = bus_service.receive_queue_message('whatsapp_sender', peek_lock=False) if msg != None and msg.body: logging.info( '%s ' % datetime.now() + msg.body) SendQueue.put(msg.body) else: logging.info( '%s ' % datetime.now() + "Empty Azure Queue") time.sleep(4.6)