Commit 412aa10d by Chavee Issariyapat

add push handler

parent 7a00be97
{
"rabbitmq_host" : "npn1.kube.nexpie.com",
"rabbitmq_port" : "31672",
"rabbitmq_username" : "b1ffb9e39865f3cb70cc2ef14920e023",
"rabbitmq_password" : "c3efbc0c4bdb1747a31cebac20d9b9b8"
}
......@@ -31,11 +31,11 @@ module.exports = function(options={}) {
var ptext = Buffer.from(data.payload, 'base64').toString();
if (stopic && ptext) {
let msg;
switch (a[0]) {
case 'wf' :
case 'writefeed' :
var msg = [{
msg = [{
"topic": stopic,
"payload":ptext,
"ts": Date.now(),
......@@ -49,8 +49,24 @@ module.exports = function(options={}) {
throw err;
}
});
break;
case 'push' :
msg = [{
"topic": stopic,
"payload":ptext,
"ts": Date.now(),
"cid": data.client_id,
}];
client.act('cmd:push', {
message: JSON.stringify(msg)
}, (err, res) => {
if (err) {
throw err;
}
});
break;
}
}
}
......
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
namespace: nexpieio
labels:
app: redis
tier: backend
spec:
# this replicas value is default
# modify it according to your case
replicas: 1
# selector can be applied automatically
# from the labels in the pod template if not set
selector:
matchLabels:
app: redis
tier: backend
template:
metadata:
labels:
app: redis
tier: backend
spec:
imagePullSecrets:
- name: docknexpie
containers:
- name: redis
image: dock.nexpie.com/stack/vernemq/redis:1.0.0-d640c8a
ports:
- containerPort: 6379
name: redis
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment