This REST API service works with coreos/etcd in order to check the message duplication.
This REST API service accepts the POST request to /distinct/
.
The duplication check flow is like below:
- This service returns
200 OK
when the received message has not been stored to etcd cluster yet, or has been expired already from etcd cluster. - Otherwise, this service returns
409 Conflict
This REST API accept Environment Variables like below:
Environment Variable | Summary | Default |
---|---|---|
LISTEN_PORT |
listen port of this service | 5001 |
ETCD_ENDPOINT |
endpoint url of etcd cluster | http://127.0.0.1:2379 |
LOCK_TTL |
expire second(s) for lock key | 10 |
DATA_TTL |
expore second(s) for data | 600 |
Content-Type: application/json
{
"payload": "message to check duplication"
}
-
Pull container techsketch/fiware-mqtt-msgfilter from DockerHub.
$ docker pull techsketch/fiware-mqtt-msgfilter
-
Run Container.
- Set environment variable(s) if you want to change exposed port, etcd endpoint, and so on.
$ env ETCD_ENDPOINT="http://192.168.0.3:2379" LISTEN_PORT="3000" docker run -d -p 3000:3000 techsketch/fiware-mqtt-msgfilter
-
go get
$ go get -u github.com/tech-sketch/fiware-mqtt-msgfilter $ cd ${GOPATH}/src/github.com/tech-sketch/fiware-mqtt-msgfilter
-
install dependencies
$ go get -u github.com/golang/dep/cmd/dep $ dep ensure
-
go install
$ go install github.com/tech-sketch/fiware-mqtt-msgfilter
-
run service
$ env ETCD_ENDPOINT="http://192.168.0.3:2379" LISTEN_PORT="3000" ${GOPATH}/bin/fiware-mqtt-msgfilter
Copyright (c) 2018 TIS Inc.