falsecz
6/5/2013 - 9:41 AM

gistfile1.coffee

stomp = require 'stomp'

stomp_args =
	port: 61613
	host: 'localhost'
	debug: no #yes

client = new stomp.Stomp stomp_args

queue = '/queue/bender';

client.connect()


cnt = 0
d = new Date()

setInterval () ->
	sec = new Date() - d
	console.log "Count: #{cnt}  time: #{sec}   rate: " + Math.round(cnt / sec * 1000) + " m/s"
	 
, 60000

client.on 'receipt', (receipt) ->
    # console.log "RECEIPT: " + receipt
	# console.log 'x'
	

	sendNext()

sendNext = () ->
	# console.log 'xxx'
	# cnt += 1
	cnt++
	x = client.send
		destination: queue
		body: 'wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww'
		persistent: yes
		mojeId: 'mrdka10'
	, yes
	
	
client.on 'connected', () ->
	start = new Date
	sendNext()
	
	# for w in [1..50]
	# 	for w in [1..10]
	# 		for i in [1..100000]
	
	
			# console.log new Date - start 
	# process.exit 1
	
	
	# console.log x
	# x = client.send
	# 	destination: queue
	# 	body: 'huuu2'
	# 	persistent: yes
	# , yes
	# 
	# # # 
	# console.log x

	# console.log client.ack 'ID:Lukass-MacBook-Pro.local-54426-1370347770407-4:22:-1:1:1'
	# 
	# client.subscribe
# 		destination: queue
# 		ack: 'client'
# 		# selector:"JMSMessageID='ID:Lukass-MacBook-Pro.local-54426-1370347770407-4:38:-1:1:1'"
# 		selector:"mojeId='mrdka10'"
# 	, (message, headers) -> 
# 		console.log 'xxxxxx', arguments
# 		client.ack headers['message-id']
# 	



client.on 'error', () ->
	console.log arguments