# install
### Linux:
`pip3 install git+https://github.com/rel8edto/kumihotools.git`
or
`pip3 install git+https://9a958136467fcee032c31fe5b6405b3d2018b653@github.com/rel8edto/kumihotools.git`
### or if only python3 installed on Windows:
pip install git+https://github.com/rel8edto/kumihotools.git
#### You will need your Github username and password to finish the install
Then you can easily control the Kumi server:
## update 2020.9.13
Added class KumihoWorker to Simplify Kumiho Project codes
# Quick Start
You can go to http://10.8.0.104:15672/#/
with username: watcher password: rel8ed.to
to see the UI tool
### Send message to an Exchange (the exchange will redirect to you message to a queue)
import kumihotools
Kumi = kumihotools.Kumi()
Kumi.createQ(Q='testQ', Ex='textEx')
Kumi.send(Ex='testEx', message='This is a test message')
Kumi.close()
### Read message and send to another Q
\# the code below will read message from testQ and send the uppercased string and send it to testQ2
import kumihotools, sys
Kumi = kumihotools.Kumi()
Kumi.createQ('testQ2', Ex='testEx2')
def callback(ch,method, property,body):
data = body.decode()
newdata = data.upper()
Kumi.send('testEx2',newdata)
ch.basic_ack(delivery_tag=method.delivery_tag)
#sys.exit() # if you want continously listen the Q remove this line
return
Kumi.receive('testQ',callback)
### Main stream Data structure
The main stream data flow as below
####KumiEggs(Ex) -> KumiEggs(Q, store CorpIDs) -> KumiNecks(Ex read NEO and send to all KumiHead Qs) -> KumiHead(many Qs the place you need to read data from) -> KumiBites (Ex receive Neo Query and send to KumiBite Qs) -> update to Neo
To create a job, you need create a new OrchiHead with a name like KumiHeadXXX to receive your data, connect it with "KumiNecks"
using:
Kumi.createQ(Q='KumiHeadXXXX',Ex='KumiNecks', rKey='',exType='direct')
the data has following struture:
[
{"id":"11","corp_id":"1111", "type":"CorpName", "node":{"nameKey":"aaaaa", "name":"aa"....}},
{"id":"11","corp_id":"1111", "type":"CorpName", "node":{"nameKey":"aaaaa", "name":"aa"....}},
.....
]
Do your job within the callback function of the read message format
See the Real Example in the code Example.py
# Tools
There are many build-in function in the package, such as:
#### fr2en, labelFilter, objCampare, json2neoNode, createAddressnode
use them like:
kumihotools.fr2en('franch words')
Find more detail in kumihotools/sword.py