I m using following code to execute my functions in a serial order. ie executing first function and then the second function.but what this code does is,it starts with the first function and immediately it skips to second function.It is not completely executing the first function.
var Step = require('step');
Step(
function first()
{
console.log(" [x] Sent %s");
var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost', function(err, conn)
{
conn.createChannel(function(err, ch)
{
var q = 'hello';
var msg='hello world';
ch.assertQueue(q, {durable: false});
// Note: on Node 6 Buffer.from(msg) should be used
ch.sendToQueue(q, new Buffer(msg));
console.log(" [x] Sent %s", msg);
});
});
this() //Calling second function
},
function second()
{
console.log('second');
}
)