File: stomp_id.rb

package info (click to toggle)
stompserver 0.9.9gem-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 424 kB
  • sloc: ruby: 2,765; sh: 162; makefile: 3
file content (21 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# This class is instantiated in all the queue storage classes, plus the queue manager (for the statistic messages).  It generates a unique
# id for each message.  The caller passes an additional identifier that is appended message-id, which is usually the id of the frame and is
# different for each storage class.

require 'socket'
require 'resolv-replace'

module StompServer
class StompId

  def initialize
    @host = Socket.gethostname.to_s
  end

  def [](id)
    msgid = sprintf("%.6f",Time.now.to_f).to_s.sub('.','-')
    msgid = @host + '-' + msgid + '-' + id.to_s
  end
end
end