Skip to content

Instantly share code, notes, and snippets.

@jamesbibby
Created August 5, 2016 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbibby/c8bf109aa3586eb8fd581f81490505b1 to your computer and use it in GitHub Desktop.
Save jamesbibby/c8bf109aa3586eb8fd581f81490505b1 to your computer and use it in GitHub Desktop.
ES6 version: queue.js
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