Skip to content
Snippets Groups Projects
Commit deac3945 authored by wactbprot's avatar wactbprot
Browse files

rm most rabbit parts

parent cba4363d
No related branches found
No related tags found
No related merge requests found
import sys
import json
import argparse
import pika
from anselm.system import System
class Anselm(System):
......@@ -13,15 +12,7 @@ class Anselm(System):
"""
def __init__(self):
super().__init__()
msg_dict = self.config['rabbitmq']
host = msg_dict['host']
self.msg_param = pika.ConnectionParameters(host=host)
self.init_ctrl_msg_prod()
self.init_stm_msg_prod()
self.init_ltm_msg_prod()
parser = argparse.ArgumentParser(
description='check systems',
usage='''anselm <command> [<args>]''')
......
......@@ -3,9 +3,6 @@
"host": "localhost",
"port": 27017
},
"rabbitmq": {
"host": "localhost"
},
"couchdb": {
"host": "localhost",
"port": 5984,
......
import sys
from anselm.system import System
import json
class Ctrl(System):
def __init__(self):
super().__init__()
self.log.info("start long-term memory init function")
self.init_stm_msg_prod()
self.init_ltm_msg_prod()
self.init_ctrl_msg_prod()
self.init_msg_consume(queue_name='ctrl', callback=self.dispatch)
def dispatch(self, ch, method, props, body):
res = json.loads(body)
found = False
contains = ""
source = ""
msg =""
if 'payload' in res:
payload = res['payload']
if 'contains' in res:
contains = res['contains']
self.log.info("contains: {}".format(contains))
if 'source' in res:
source = res['source']
self.log.info("source: {}".format(source))
if 'msg' in res:
msg = res['msg']
self.log.info("msg: {}".format(msg))
if source == "stm" and contains == "task":
print(payload)
found = True
if source == "ltm" and contains == "auxobj":
self.stm_pub(body_dict={
'do':"build_auxobj_db",
'payload':payload
})
found = True
if source == "ltm" and contains == "mpdoc":
self.stm_pub(body_dict={
'do':"build_mp_db",
'payload':payload
})
found = True
if source == "stm" and msg == "insert_mp_doc_complete":
self.stm_pub(body_dict={
'do':"build_mp_db",
'payload':payload
})
found = True
if found:
self.log.info("found branch for routing key")
else:
self.log.error("no branch found")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment