I am making a request from my node.js service to backend service to get some data. However the data i receive from request/response is incomplete because my response is only complete when I get the remaining data from rabbitMQ. The rabbitMq update and the request I am making are using the same unique id. In this scenario, what is the best way to match up unique ids and complete my response to send to the browser ?
My response from the request looks like this
var a1 = [{ uid : 1, name : "test1", age : "NA"}, { uid : 1, name : "test2", age : "NA"}]
RabbitMq gives me the following array
var a2 = [{ uid : 1, age: "test1", age : "34", city: "new york"}, { uid : 1, name : "test2", age : "36", city: "new orleans"}]
How can I combine these two arrays that share a common uid and then form a response like below to send to the browser
[{ uid : 1, age: "test1", age : "34", city: "new york"}, { uid : 1, name : "test2", age : "36", city: "new orleans"}]
via user6860877
No comments:
Post a Comment