HOMER HepSub
Pub-Sub Data Agents for HOMER/HEP
HEPSUB
HOMER Seven allows external agents to subscribe capabilities to provide "on-demand" session details from external APIs, databases, etc. to argument internally available data without requiring data duplication and allowing creative use of the core HEP platform.
So What?
This application publishes itself as an endpoint for the HEP Pub-Sub API, announcing its capabilities to asyncronously return on-demand complementary information about correlated sessions.
What does this do?
This example project does not provide any actual logic and implements the basic pub-sub mechanism plus a sample endpoint returning JSON data to be extended with any desirable action such as looking up logs, events, packets and returning them to a standard or custom handler.
[{"id":"ac33c08c.4535c","type":"tab","label":"HEPSUB HOMER","disabled":false,"info":""},{"id":"db0b9a7d.5b8bb8","type":"http in","z":"ac33c08c.4535c","name":"GET /hepsub","url":"/hepsub/:name","method":"get","upload":false,"swaggerDoc":"","x":310,"y":100,"wires":[["2abef379.44f14c","72d9b59c.d1a07c"]]},{"id":"4d82fa76.27b354","type":"http in","z":"ac33c08c.4535c","name":"POST /hepsub","url":"/hepsub/:name","method":"post","upload":false,"swaggerDoc":"","x":320,"y":180,"wires":[["2abef379.44f14c","72d9b59c.d1a07c"]]},{"id":"2abef379.44f14c","type":"template","z":"ac33c08c.4535c","name":"Echo","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{ \n \"echo\": \"{{req.params.name}}\", \n \"agent\": \"node-red\"\n}","x":510,"y":60,"wires":[["ae2cc192.73c95","72d9b59c.d1a07c"]]},{"id":"ae2cc192.73c95","type":"change","z":"ac33c08c.4535c","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":60,"wires":[["5040e9aa.54f158","72d9b59c.d1a07c"]]},{"id":"5040e9aa.54f158","type":"http response","z":"ac33c08c.4535c","name":"","statusCode":"","headers":{},"x":850,"y":60,"wires":[]},{"id":"caaf2e69.bc43b","type":"inject","z":"ac33c08c.4535c","name":"","topic":"","payload":"","payloadType":"date","repeat":"290","crontab":"","once":false,"onceDelay":"","x":190,"y":380,"wires":[["99254cd4.bbb09"]]},{"id":"3d2d3cfe.67a474","type":"http request","z":"ac33c08c.4535c","name":"POST HEPSUB","method":"POST","ret":"obj","paytoqs":false,"url":"http://homer.app/api/v3/agent/subscribe","tls":"","persist":true,"proxy":"","authType":"","x":680,"y":380,"wires":[["72d9b59c.d1a07c"]]},{"id":"81d6ea22.257ae8","type":"function","z":"ac33c08c.4535c","name":"HEPSUB Config","func":"var xmsg = {}\nxmsg.payload = {\n\t\"uuid\": \"71420813-03de-4002-9c37-df710087fb6a\", // MUST be a valid UUIDv4\n\t\"port\": 1880,\n\t\"protocol\": \"http\",\n\t\"path\": \"/hepsub\",\n\t\"type\": \"cdr\",\n\t\"ttl\": 300,\n\t\"node\": \"test-endpoint\",\n\t\"gid\": 10\n };\nxmsg.payload.host = msg.payload.publicIPv4;\nxmsg.headers = {};\nxmsg.headers['Access-Control-Allow-Origin'] = '*';\nxmsg.headers['Access-Control-Allow-Headers'] = 'X-Requested-With';\nxmsg.headers['Auth-Token'] = 'jIQgdKTDQwKtSOvLXOLarFCrckWfHDIRtQQegvcDXhFRvISQvszTMLXuRNJtKuiEDNOurBEMtQURQjOx';\n\nreturn xmsg;","outputs":1,"noerr":0,"x":500,"y":380,"wires":[["3d2d3cfe.67a474"]]},{"id":"72d9b59c.d1a07c","type":"debug","z":"ac33c08c.4535c","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":940,"y":260,"wires":[]},{"id":"99254cd4.bbb09","type":"ip","z":"ac33c08c.4535c","name":"Detect IP","https":false,"timeout":"5000","internalIPv4":true,"internalIPv6":false,"publicIPv4":true,"publicIPv6":false,"x":340,"y":380,"wires":[["81d6ea22.257ae8","72d9b59c.d1a07c"]]},{"id":"9af2d6e2.81c208","type":"comment","z":"ac33c08c.4535c","name":"pub","info":"press to publish a subscription towards a HEPSUB server","x":170,"y":420,"wires":[]},{"id":"b7070f69.ea221","type":"comment","z":"ac33c08c.4535c","name":"Sub","info":"This is the entry pipeline for HEPGEN requests dispatched to a registered agent","x":290,"y":140,"wires":[]}]