Discussion:
[rabbitmq-users] how can I give value as variable for count.
sai kumar m
2015-07-30 16:08:05 UTC
Permalink
Hi,
I am using following code for geting data from RabbitMQ Queue.
var http = require('https');

var options = {
host: 'owl.rmq.cloudamqp.com',
path: '/api/queues/pwlxewml/Account2/get',
//This is what changes the request to a POST request
method: 'POST',
headers: {
'Authorization': 'Basic ' + new Buffer('*******' + ':' +
'*****').toString('base64')
}
};

callback = function(response) {
var str = ''
response.on('data', function (chunk) {
str += chunk;
});

response.on('end', function () {
console.log(str);
});
}

var req = http.request(options, callback);

req.on('error', function(err) {
console.log(err);
});

//This is the data we are posting, it needs to be a string or a buffer
var abc=req.write('{"count":1,"requeue":false,"encoding":"auto"}');
//console.log("sample"+abc);
req.end();


Here I am using ('{"count":1,"requeue":false,"encoding":"auto"}');

*1)how can I give value as variable for count.*
*2)how can i use conditions for requeue":false(means in particular case
message will be dequed in other cases it sholud be there.*
*How can I do this?*
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Klishin
2015-07-30 16:32:34 UTC
Permalink
Post by sai kumar m
Here I am using ('{"count":1,"requeue":false,"encoding":"auto"}');
1)how can I give value as variable for count.
Serialise an object to json?
Post by sai kumar m
2)how can i use conditions for requeue":false(means in particular case message will be dequed in other cases it sholud be there.
How can I do this?
This sounds like a basic JavaScript question. Or am I misunderstanding it?
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+***@googlegroups.com.
To post to this group, send an email to rabbitmq-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...