Vorbereitung Release 03.0 #94
@@ -33,8 +33,8 @@ class AddLinkListener(stomp.ConnectionListener):
|
|||||||
link = msgspec.json.decode(frame.body, type=Link)
|
link = msgspec.json.decode(frame.body, type=Link)
|
||||||
self.log.info("found link: %s", link.url)
|
self.log.info("found link: %s", link.url)
|
||||||
json_bytes = msgspec.json.encode(link)
|
json_bytes = msgspec.json.encode(link)
|
||||||
self.conn.send(body=json_bytes, destination="add_link_accepted")
|
self.conn.send(body=json_bytes, destination="media.link.add.processed")
|
||||||
self.conn.send(body=json_bytes, destination="update_title")
|
self.conn.send(body=json_bytes, destination="media.link.update_title")
|
||||||
|
|
||||||
class UpdateTitleListener(stomp.ConnectionListener):
|
class UpdateTitleListener(stomp.ConnectionListener):
|
||||||
def __init__(self, log, conn):
|
def __init__(self, log, conn):
|
||||||
@@ -49,27 +49,27 @@ class UpdateTitleListener(stomp.ConnectionListener):
|
|||||||
link = msgspec.json.decode(frame.body, type=Link)
|
link = msgspec.json.decode(frame.body, type=Link)
|
||||||
self.log.info("found link: %s", link.url)
|
self.log.info("found link: %s", link.url)
|
||||||
json_bytes = msgspec.json.encode(link)
|
json_bytes = msgspec.json.encode(link)
|
||||||
self.conn.send(body=json_bytes, destination="update_title_accepted")
|
self.conn.send(body=json_bytes, destination="media.link.update_title.processed")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logger = get_logger(args.verbose, __file__)
|
logger = get_logger(args.verbose, __file__)
|
||||||
logger.info("kontor.read_queue started")
|
logger.info("kontor.read_queue started")
|
||||||
APICONFIG = get_api_config(logger, args.config)
|
#APICONFIG = get_api_config(logger, args.config)
|
||||||
first_server: Optional[Server] = APICONFIG.get_server("inky")
|
#first_server: Optional[Server] = APICONFIG.get_server("inky")
|
||||||
if not first_server:
|
#if not first_server:
|
||||||
sys.exit(2)
|
# sys.exit(2)
|
||||||
data = first_server.request(log=logger, table="media_file")
|
#data = first_server.request(log=logger, table="media_file")
|
||||||
host = [(args.messages, args.port)]
|
host = [(args.messages, args.port)]
|
||||||
conn_add = stomp.Connection(host_and_ports=host)
|
conn_add = stomp.Connection(host_and_ports=host)
|
||||||
conn_add.set_listener('', AddLinkListener(logger, conn_add))
|
conn_add.set_listener('', AddLinkListener(logger, conn_add))
|
||||||
conn_add.connect(username='artemis', passcode='artemis', wait=True)
|
conn_add.connect(username='artemis', passcode='artemis', wait=True)
|
||||||
conn_add.subscribe(destination='add_link', id=1, ack='auto', headers={})
|
conn_add.subscribe(destination='media.link', id=1, ack='auto', headers={})
|
||||||
|
|
||||||
conn_update = stomp.Connection(host_and_ports=host)
|
conn_update = stomp.Connection(host_and_ports=host)
|
||||||
conn_update.set_listener('', UpdateTitleListener(logger, conn_update))
|
conn_update.set_listener('', UpdateTitleListener(logger, conn_update))
|
||||||
conn_update.connect(username='artemis', passcode='artemis', wait=True)
|
conn_update.connect(username='artemis', passcode='artemis', wait=True)
|
||||||
conn_update.subscribe(destination='update_title', id=1, ack='auto', headers={})
|
conn_update.subscribe(destination='media.link.update_title', id=1, ack='auto', headers={})
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
conn_add.disconnect()
|
conn_add.disconnect()
|
||||||
conn_update.disconnect()
|
conn_update.disconnect()
|
||||||
|
|||||||
Generated
+347
-310
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user