Skip to content

Commit

Permalink
Corrected the function call #40
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya committed Mar 1, 2022
1 parent 3c63518 commit fdb83a7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions weather-data-ingestor-microservice/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

const express = require('express')
const routes = require('./api/routes');

const controller = require('./api/controller');
console.log(controller)

//init express
const app = express()
Expand All @@ -28,7 +28,7 @@ amqp.connect('amqp://localhost', function(error0, connection) {
if (error1) {
throw error1;
}
var queue = 'rpc_queue';
var queue = 'rpc_queue_1';

channel.assertQueue(queue, {
durable: false
Expand All @@ -38,10 +38,14 @@ amqp.connect('amqp://localhost', function(error0, connection) {
console.log(' [x] Awaiting RPC requests');
channel.consume(queue, function reply(msg) {

// var n = parseInt(msg.content.toString());
// var n = parseInt(msg.content.toString());
var n = parseInt(msg.content);

// console.log(" [.] fib(%d)", n);
// console.log(" [.] fib(%d)", n);
console.log(n);

var r = controller.fib(n);
console.log(r)
// var r = fibonacci(n); // function call. need to check with anita
console.log("msg"+msg.content.toJSON());
var r= msg.content;
Expand All @@ -56,9 +60,3 @@ amqp.connect('amqp://localhost', function(error0, connection) {
});
});

// function fibonacci(n) {
// if (n == 0 || n == 1)
// return n;
// else
// return fibonacci(n - 1) + fibonacci(n - 2);
// }

0 comments on commit fdb83a7

Please sign in to comment.