This repository has been archived on 2020-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
producer/app.py

36 lines
985 B
Python
Raw Normal View History

2020-03-29 12:44:20 +02:00
#!/usr/bin/env python
import random
import uuid
import logging
2020-03-29 12:44:20 +02:00
import sentry_sdk
import time
from communicator import Communicator
from consumerlocator import ConsumerLocator
from messagesender import MessageSender
2020-03-29 12:44:20 +02:00
"""
Main entrypoint
2020-03-29 12:44:20 +02:00
"""
__author__ = "@tormakris"
__copyright__ = "Copyright 2020, GoldenPogácsa Team"
__module_name__ = "app"
__version__text__ = "1"
sentry_sdk.init("https://3fa5ae886ba1489092ad49a93cb419c1@sentry.kmlabz.com/9")
logging.basicConfig(level=logging.INFO)
LOGGER = logging.getLogger(__name__)
2020-03-29 12:44:20 +02:00
if __name__ == "__main__":
LOGGER.info("Producer started")
generateduuid = str(uuid)
LOGGER.debug(f"My uuid is {generateduuid}")
consumerlocator = ConsumerLocator()
communicator = Communicator(consumerlocator=consumerlocator,uuid=uuid)
messagesender = MessageSender(communicator=communicator)
while True:
LOGGER.info("Sending message to consumer")
messagesender.sendmessage()
time.sleep(random.random())