automated terminal push
This commit is contained in:
21
consumer.py
21
consumer.py
@@ -2,6 +2,8 @@ import stomp
|
|||||||
import time
|
import time
|
||||||
import SullyGnomeRobot
|
import SullyGnomeRobot
|
||||||
import RestAPIClient
|
import RestAPIClient
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
print("## ")
|
print("## ")
|
||||||
print("## starting > JMS consumer (yankee-sully-channels-monthly)")
|
print("## starting > JMS consumer (yankee-sully-channels-monthly)")
|
||||||
@@ -60,9 +62,10 @@ class MyListener(stomp.ConnectionListener):
|
|||||||
RestAPIClient.addDownloadFailure(message.body, "error from onmessage (consumer.py)")
|
RestAPIClient.addDownloadFailure(message.body, "error from onmessage (consumer.py)")
|
||||||
|
|
||||||
print("## ")
|
print("## ")
|
||||||
print("## starting > JMS consumer (yankee-sully-channels-monthly)")
|
print("## starting > (timed) JMS consumer (yankee-sully-channels-monthly)")
|
||||||
print("## ")
|
print("## ")
|
||||||
|
|
||||||
|
|
||||||
conn = stomp.Connection([('67.220.70.106', 61613)])
|
conn = stomp.Connection([('67.220.70.106', 61613)])
|
||||||
|
|
||||||
conn.set_listener('', MyListener())
|
conn.set_listener('', MyListener())
|
||||||
@@ -75,10 +78,24 @@ print("## ")
|
|||||||
print("## notification > connected to JMS server (yankee-sully-channels-monthly) 3333")
|
print("## notification > connected to JMS server (yankee-sully-channels-monthly) 3333")
|
||||||
print("## ")
|
print("## ")
|
||||||
|
|
||||||
while True:
|
start_time = time.time()
|
||||||
|
|
||||||
|
print("start time /",start_time)
|
||||||
|
|
||||||
|
counter=0
|
||||||
|
|
||||||
|
while time.time() - start_time < 60:
|
||||||
|
|
||||||
|
counter = counter + 1
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
print("waiting for 60 seconds of elapsed time: ",counter)
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
print("it's been 60 seconds. what up though?")
|
||||||
|
|
||||||
conn.disconnect()
|
conn.disconnect()
|
||||||
|
|
||||||
|
print("disconnected from JMS. i'll holla!")
|
||||||
|
|||||||
Reference in New Issue
Block a user