# limitations under the License. import os import json import time from pika.exceptions import ConnectionClosed, StreamLostError import cloudify.event import cloudify.logs from cloudify_cli.colorful_event import ColorfulEvent from cloudify.constants import EVENTS_EXCHANGE_NAME, LOGS_EXCHANGE_NAME from integration_tests.framework import utils logger = utils.setup_logger('events_printer') def _consume_events(connection): channel = connection.channel() queues = [] # Binding the logs queue _bind_queue_to_exchange(channel, LOGS_EXCHANGE_NAME, 'fanout', queues) # Binding the events queue _bind_queue_to_exchange(channel, EVENTS_EXCHANGE_NAME, 'topic', queues, routing_key='events.#')
import json import os import sys import threading from pika.exceptions import ConnectionClosed import cloudify.event import cloudify.logs from cloudify_cli.colorful_event import ColorfulEvent from cloudify.constants import EVENTS_EXCHANGE_NAME, LOGS_EXCHANGE_NAME from integration_tests.framework import utils logger = utils.setup_logger('events_printer') class EventsPrinter(threading.Thread): def __init__(self): super(EventsPrinter, self).__init__() self.daemon = True def run(self): """ This function will consume logs and events directly from the cloudify-logs and cloudify-events-topic exchanges. (As opposed to the usual means of fetching events using the REST api). Note: This method is only used for events/logs printing.