stomping_ground 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,8 @@ module StompingGround
3
3
  module Stomp
4
4
 
5
5
  attr_writer :message_body
6
+ attr_writer :queue_name
7
+ attr_writer :published_message_filename
6
8
 
7
9
  def post_init
8
10
  end
@@ -16,22 +18,28 @@ module StompingGround
16
18
  send_data "\n"
17
19
  send_data "\0"
18
20
  when "SUBSCRIBE"
19
- message = @message_body || "hello"
20
- send_data "MESSAGE\n"
21
- send_data "subscription:#{frame_info[:id]}\n"
22
- send_data "message-id:007\n"
23
- send_data "destination:#{frame_info[:destination]}\n"
24
- send_data "content-type:text/plain\n"
25
- send_data "content-length:#{message.length}\n"
26
- send_data "\n"
27
- send_data "#{message}\0"
21
+ File.open("test.txt", "w") do |file|
22
+ file.write(frame_info[:destination])
23
+ end
24
+ if frame_info[:destination] == @queue_name
25
+ message = @message_body || "hello"
26
+ send_data "MESSAGE\n"
27
+ send_data "subscription:#{frame_info[:id]}\n"
28
+ send_data "message-id:007\n"
29
+ send_data "destination:#{frame_info[:destination]}\n"
30
+ send_data "content-type:text/plain\n"
31
+ send_data "content-length:#{message.length}\n"
32
+ send_data "\n"
33
+ send_data "#{message}\0"
34
+ end
28
35
  when "DISCONNECT"
29
36
  send_data "RECEIPT\n"
30
37
  send_data "receipt-id:99\n"
31
38
  send_data "\0"
32
39
  close_connection
33
40
  when "SEND"
34
- File.open("stomping_ground_message.txt", "w") do |file|
41
+ filename = @published_message_filename || "stomping_ground_message.txt"
42
+ File.open(filename, "w") do |file|
35
43
  file.write(frame)
36
44
  end
37
45
  end
@@ -67,6 +75,8 @@ module StompingGround
67
75
  EventMachine.run {
68
76
  EventMachine.start_server @host, @port, StompingGround::Stomp do |server|
69
77
  server.message_body = options[:message]
78
+ server.queue_name = options[:queue_name]
79
+ server.published_message_filename = options[:published_message_filename]
70
80
  end
71
81
  }
72
82
  end
@@ -1,5 +1,5 @@
1
1
  module StompingGround
2
2
  MAJOR=0
3
- MINOR=2
3
+ MINOR=3
4
4
  VERSION="#{MAJOR}.#{MINOR}"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stomping_ground
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onstomp
16
- requirement: &2164809700 !ruby/object:Gem::Requirement
16
+ requirement: &2169022720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2164809700
24
+ version_requirements: *2169022720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2164809240 !ruby/object:Gem::Requirement
27
+ requirement: &2169022260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2164809240
35
+ version_requirements: *2169022260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &2164808800 !ruby/object:Gem::Requirement
38
+ requirement: &2169021800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164808800
46
+ version_requirements: *2169021800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &2164808220 !ruby/object:Gem::Requirement
49
+ requirement: &2169021240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164808220
57
+ version_requirements: *2169021240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: eventmachine
60
- requirement: &2164807460 !ruby/object:Gem::Requirement
60
+ requirement: &2169020380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2164807460
68
+ version_requirements: *2169020380
69
69
  description:
70
70
  email:
71
71
  executables: []
@@ -75,7 +75,7 @@ files:
75
75
  - lib/stomping_ground/server.rb
76
76
  - lib/stomping_ground/version.rb
77
77
  - lib/stomping_ground.rb
78
- homepage:
78
+ homepage: http://github.com/frankmt/stomping_ground
79
79
  licenses: []
80
80
  post_install_message:
81
81
  rdoc_options: []