Public Repository

Last pushed: 7 months ago
Short Description
Simple Publish/Subscribe module over a specified data streams using user specified filter criteria
Full Description

Simple Publish/Subscribe module over a specified (Kafka/UDP) data streams using user specified filter criteria.

How to Run:
docker run -p 4455:4455 --env KAFKA_URL=kafka://<kafka-host>:9092/topic=test srikanthvavila/cord-publish-subscribe

This module supports two REST APIs:
http://<container host ip>:4455/subscribe - Subscribes to a subset of events as specified in filter criteria
http://<container host ip>:4455/unsubscribe - Unsubscribe to the data

Examples:

  • curl -i -H "Content-Type: application/json" -X POST -d '{"app_id":"10","target":"kafka://<kafka-host>:9092?topic=test9","sub_info":"cpu_util","query":[{"field":"project_id","op":"eq","value":"02a658d20a924dafb0fe2118d5ed1a3c"}]}' -L http://<container host ip>:4455/subscribe

The above API initiate subscription for all events where event['counter_name'] =="cpu_util" && event['project_id']=="02a658d20a924dafb0fe2118d5ed1a3c"

  • curl -i -H "Content-Type: application/json" -X POST -d '{"app_id":"10"}' -L http://<container host ip>:4455/unsubscribe

This module expects the the input data in the following format:
{
"counter_name": "cpu_util",
"user_id": "a1e5362b35db4409a16684b0b5ab0ff3",
"timestamp": "2017-03-03T06:17:58.119363",
"resource_id": "160c6a31-f880-4c82-bd69-9a9a089b2679",
"message_id": "26094d1c-ffd9-11e6-b2a2-0242ac110005",
"source": "openstack",
"counter_unit": "%",
"counter_volume": 2.8075886704874646,
"project_id": "02a658d20a924dafb0fe2118d5ed1a3c",
"metadata": {"status": "active", "cpu_number": 1, "ramdisk_id": null, "display_name": "mysite_test_ceilometer-6", "name": "instance-00000008", "disk_gb": 20, "kernel_id": null, "image": {"id": "e058a3f4-3bb6-4cb5-8d27-2d40b1634c8d", "name": "trusty-server-multi-nic"}, "ephemeral_gb": 0, "host": "c8baa61fbbbe84e09e09b55bcdc610092087ebf2988b0582e98ee614", "memory_mb": 2048, "instance_type": "m1.small", "vcpus": 1, "root_gb": 20, "image_ref": "e058a3f4-3bb6-4cb5-8d27-2d40b1634c8d", "flavor": {"name": "m1.small", "ram": 2048, "ephemeral": 0, "vcpus": 1, "disk": 20, "id": "2"}, "OS-EXT-AZ:availability_zone": "nova"} "counter_type": "gauge"
}

Docker Pull Command
Owner
srikanthvavila

Comments (0)