Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 1 | |
| 2 | Subscribe-Publish Frame Work: |
| 3 | 1.Command to Install Flask Webserver frame work. |
| 4 | sudo pip install Flask |
| 5 | |
| 6 | Along with flask we need the following packages: |
| 7 | msgpack |
| 8 | fnmatch |
| 9 | operator |
| 10 | logging |
| 11 | oslo_utils |
| 12 | ConfigParser |
| 13 | |
| 14 | 2.Files: i.sub_main.py |
| 15 | ii.pubrecords.py |
| 16 | iii.pub_sub.conf |
| 17 | |
| 18 | 3.Command to start the server: |
| 19 | #python sun_main.py |
| 20 | 4.Command for subscription: |
| 21 | i.app_id:Application ID,should be unique. |
| 22 | ii.target: |
| 23 | Presently only udp is supported. |
| 24 | a.udp:<ip:portno> |
| 25 | b.kafka:<kafkaip:kafkaport> |
| 26 | iii.sub_info:Sunscription notifications.ex:cpu_util,cpu_* |
| 27 | iv.query: |
| 28 | Below information need to provide as part of query. |
| 29 | a.field:fileds like user id ,porject id etc., |
| 30 | b.op:"eq","gt","lt" etc., |
| 31 | c.value:value of the fileds. |
| 32 | Example: |
| 33 | curl -i -H "Content-Type: application/json" -X SUB -d '{"app_id":"10","target":"udp://10.11.10.1:5006","sub_info":"cpu_util","query":[{"field":"user_id","op":"eq","value":"e1271a86bd4e413c87248baf2e5f01e0"},{"field":"project_id","op":"eq","value":"b1a3bf16d2014b47be9aefea88087318"},{"field":"resource_id","op":"eq","value":"658cd03f-d0f0-4f55-9f48-39e7222a8646"}]}' -L http://10.11.10.1:4455/subscribe |
| 34 | |
| 35 | 5.Command for unsunscription: |
| 36 | For unsubcription only appid will be needed. |
| 37 | curl -i -H "Content-Type: application/json" -X UNSUB -d '{"app_id":"10"}' http://10.11.10.1:4455/unsubscribe |