easternbloc / node-stomp-client

A STOMP client for Node.js
Other
93 stars 47 forks source link

Queue message repetition #75

Open c-y-q opened 5 years ago

c-y-q commented 5 years ago

code:

var Stomp = require('stomp-client'); var dest2 = '/queue/st5'; var client = new Stomp('127.0.0.1', 61613, 'admin', 'admin'); client.connect(function(sessionId) { console.log(sessionId) client.publish(dest2,JSON.stringify({name:'消灭',age:23})); client.publish(dest2,JSON.stringify({name:'xiaohua',age:3})); client.subscribe(dest2,function(data){ console.log('from queue: '+data) }) client.subscribe(dest2,function(data){ console.log('from queue2: '+data) })

});

console : ID:WIN-KMVDG7DGGD4-49230-1558420488751-5: from queue: {"name":"消灭","age":23} from queue2: {"name":"消灭","age":23} from queue: {"name":"xiaohua","age":3} from queue2: {"name":"xiaohua","age":3}