Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
6d8b509d
Commit
6d8b509d
authored
Dec 27, 2016
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
1df8592f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
test_rpccli.js
test/test_rpccli.js
+36
-0
No files found.
test/test_rpccli.js
0 → 100644
View file @
6d8b509d
var
amqp
=
require
(
'amqplib/callback_api'
);
var
args
=
process
.
argv
.
slice
(
2
);
if
(
args
.
length
==
0
)
{
console
.
log
(
"Usage: rpc_client.js num"
);
process
.
exit
(
1
);
}
amqp
.
connect
(
'amqp://bigmaster.igridproject.info'
,
function
(
err
,
conn
)
{
conn
.
createChannel
(
function
(
err
,
ch
)
{
ch
.
assertQueue
(
''
,
{
exclusive
:
true
},
function
(
err
,
q
)
{
var
corr
=
generateUuid
();
var
num
=
parseInt
(
args
[
0
]);
console
.
log
(
' [x] Requesting fib(%d)'
,
num
);
ch
.
consume
(
q
.
queue
,
function
(
msg
)
{
if
(
msg
.
properties
.
correlationId
==
corr
)
{
console
.
log
(
' [.] Got %s'
,
msg
.
content
.
toString
());
setTimeout
(
function
()
{
conn
.
close
();
process
.
exit
(
0
)
},
500
);
}
},
{
noAck
:
true
});
ch
.
sendToQueue
(
'rpc_queue'
,
new
Buffer
(
num
.
toString
()),
{
correlationId
:
corr
,
replyTo
:
q
.
queue
});
});
});
});
function
generateUuid
()
{
return
Math
.
random
().
toString
()
+
Math
.
random
().
toString
()
+
Math
.
random
().
toString
();
}
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