35 lines
902 B
Python
35 lines
902 B
Python
#!/usr/bin/env python
|
|
import sentry_sdk
|
|
import communicator
|
|
import consumerlocator
|
|
import messagesender
|
|
|
|
|
|
"""
|
|
Main Flask RESTful API
|
|
"""
|
|
|
|
__author__ = "@tormakris"
|
|
__copyright__ = "Copyright 2020, GoldenPogácsa Team"
|
|
__module_name__ = "app"
|
|
__version__text__ = "1"
|
|
|
|
sentry_sdk.init("https://3fa5ae886ba1489092ad49a93cb419c1@sentry.kmlabz.com/9")
|
|
|
|
if __name__ == "__main__":
|
|
print("Producer: init")
|
|
comm = communicator.Communicator()
|
|
conslist = consumerlocator.ConsumerLocator()
|
|
conslist.initCommunicator(comm)
|
|
message = messagesender.MessageSender()
|
|
|
|
conslist.learnconsumerlist()
|
|
print("Producer: started sending")
|
|
for i in range(30):
|
|
print("Producer: send %i message", i)
|
|
msg = message.CreateMessage(20)
|
|
if not conslist.checkcurrentconsumer():
|
|
conslist.updateconsumer()
|
|
comm.sendmessage(msg)
|
|
|
|
print("Producer: finished") |