Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
b8c89812
Commit
b8c89812
authored
Jul 11, 2018
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change msg format
parent
de63d9cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
pubhook/on_publish.js
+21
-23
No files found.
pubhook/on_publish.js
View file @
b8c89812
...
@@ -10,7 +10,7 @@ var client = require('seneca')()
...
@@ -10,7 +10,7 @@ var client = require('seneca')()
.
use
(
'seneca-amqp-transport'
)
.
use
(
'seneca-amqp-transport'
)
.
client
({
.
client
({
type
:
'amqp'
,
type
:
'amqp'
,
pin
:
'cmd:w
ritefeed,feedid:serialno
'
,
pin
:
'cmd:w
f
'
,
url
:
'amqp://'
+
config
.
get
(
'rabbitmq_username'
)
+
':'
+
config
.
get
(
'rabbitmq_password'
)
+
'@'
+
config
.
get
(
'rabbitmq_host'
)
+
':'
+
config
.
get
(
'rabbitmq_port'
)
url
:
'amqp://'
+
config
.
get
(
'rabbitmq_username'
)
+
':'
+
config
.
get
(
'rabbitmq_password'
)
+
'@'
+
config
.
get
(
'rabbitmq_host'
)
+
':'
+
config
.
get
(
'rabbitmq_port'
)
});
});
...
@@ -26,34 +26,32 @@ module.exports = function(options={}) {
...
@@ -26,34 +26,32 @@ module.exports = function(options={}) {
var
data
=
req
.
body
;
var
data
=
req
.
body
;
if
(
data
.
topic
.
substring
(
0
,
5
)
==
'$exec'
)
{
if
(
data
.
topic
.
substring
(
0
,
5
)
==
'$exec'
)
{
var
stopic
=
data
.
topic
.
substr
(
6
);
var
a
=
data
.
topic
.
split
(
'/'
);
var
a
=
data
.
topic
.
split
(
'/'
);
var
ptext
=
Buffer
.
from
(
data
.
payload
,
'base64'
).
toString
();
var
ptext
=
Buffer
.
from
(
data
.
payload
,
'base64'
).
toString
();
// temp
if
(
stopic
&&
ptext
)
{
var
p
=
ptext
.
split
(
':'
);
switch
(
a
[
0
])
{
case
'wf'
:
case
'writefeed'
:
switch
(
a
[
1
])
{
var
msg
=
[{
case
'wf'
:
"topic"
:
stopic
,
case
'writefeed'
:
"payload"
:
ptext
,
var
data
=
[{
"ts"
:
Date
.
now
(),
"name"
:
a
[
2
],
"cid"
:
data
.
client_id
,
"timestamp"
:
Date
.
now
(),
}];
"topic"
:
data
.
topic
,
"payload"
:
ptext
,
"value"
:
p
[
1
],
// temp
client
.
act
(
'cmd:wf'
,
{
"tags"
:{
"attr"
:
p
[
0
]}
// temp
message
:
JSON
.
stringify
(
msg
)
}];
},
(
err
,
res
)
=>
{
if
(
err
)
{
throw
err
;
}
});
client
.
act
(
'cmd:writefeed,feedid:serialno'
,
{
break
;
message
:
JSON
.
stringify
(
data
)
}
},
(
err
,
res
)
=>
{
if
(
err
)
{
throw
err
;
}
});
break
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment