Created
August 5, 2016 17:39
-
-
Save jamesbibby/c8bf109aa3586eb8fd581f81490505b1 to your computer and use it in GitHub Desktop.
ES6 version: queue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Stomp from 'stomp-client'; | |
const destination = 'pdp.integration'; | |
const client1 = new Stomp('54.215.168.194', 62613); | |
const client2 = new Stomp('54.215.168.194', 62616); | |
export function updateTickets() { | |
console.log('about to send message 1'); | |
client1.connect(function(sessionId) { | |
console.log('sending a message!'); | |
client1.publish(destination, { | |
eventName: 'PDP_Ticket_Balance_Change', | |
accountNumber: '12341234', | |
balance: 150, | |
timestamp: Math.floor(new Date() / 1000), | |
}); | |
return 'Published'; | |
}, | |
function(error) { | |
console.log(error); | |
return error; | |
}); | |
if (client2) { | |
console.log('about to send message 2'); | |
client2.connect(function(sessionId) { | |
console.log('sending a message!'); | |
client2.publish(destination, { | |
eventName: 'PDP_Ticket_Balance_Change', | |
accountNumber: '12341234', | |
balance: 150, | |
timestamp: Math.floor(new Date() / 1000), | |
}); | |
return 'Published'; | |
}, | |
function(error) { | |
console.log(error); | |
return error; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment