def main(): log.info(f"main() is started") """ env docker에서는 -e 옵션 그냥 맥에서 실행할때는 export """ source_username = os.environ['S_USER'] source_password = os.environ['S_PASS'] source_database = os.environ['S_DATABASE'] source_table = os.environ['S_TABLE'] try: api = API(database=source_database, username=source_username, password=source_password) api.authenticate() except Exception as e: log.error(e) raise e """ 최대 에러 수 는 100회로 제한 재접속 성공 시 초기화 """ max_feed_error_count = 0 while max_feed_error_count < 100: try: feed.DataFeed(api, CustomDataDataFeedListener(api), source_table, interval=12).start(threaded=False) max_feed_error_count = 0 except Exception as e: log.error(e) log.info('max_feed_error_count : ' + str(max_feed_error_count)) max_feed_error_count += 1 time.sleep(6)
def main(database, user=None, password=None, server=None, interval=60): api = API(database=database, username=user, password=password, server=server) api.authenticate() feed.DataFeed(api, ExceptionDataFeedListener(api), "ExceptionEvent", interval=interval).start()
def main(database='layetest', user='******', password='******', server=None, interval=60): api = API(database=database, username=user, password=password, server=server) api.authenticate() feed.DataFeed(api, DataFeedListener(api), "LogRecord", interval=interval).start()