stilts-stomp-client 0.1.4-java → 0.1.5-java

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  module StiltsStompClient
2
- VERSION = '0.1.4'
3
- MAVEN_VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
+ MAVEN_VERSION = '0.1.5'
4
4
  end
5
5
  begin
6
6
  require 'java'
Binary file
@@ -1,9 +1,53 @@
1
1
 
2
2
  module Stilts
3
3
  module Stomp
4
+
5
+
4
6
  class Client < org.projectodd.stilts.stomp.client::StompClient
5
-
7
+
8
+ alias_method :original_subscribe, :subscribe
9
+
10
+ def subscribe(destination, opts={}, &block)
11
+ builder = original_subscribe( destination )
12
+ builder.withSelector( opts[:selector] ) if ( opts[:selector] )
13
+ builder.withMessageHandler( BlockMessageHandler.new( block ) )
14
+ builder.withAckMode( org.projectodd.stilts.stomp::Subscription::AckMode::AUTO )
15
+ builder.start
16
+ end
17
+
18
+ alias_method :original_send, :send
19
+
20
+ def send(destination, message)
21
+ stomp_message = org.projectodd.stilts.stomp::StompMessages.createStompMessage( destination, message )
22
+ original_send( stomp_message )
23
+ end
24
+
25
+ end # -- Client
26
+
27
+ class BlockMessageHandler
28
+
29
+ include org.projectodd.stilts.stomp.client::MessageHandler
30
+
31
+ def initialize(block)
32
+ @block = block
33
+ end
34
+
35
+ def handle(message)
36
+ @block.call( StompMessage.new( message ) )
37
+ end
38
+
39
+ end # -- BlockMessageHandler
40
+
41
+ class StompMessage
42
+ def initialize(message)
43
+ @message = message
44
+ end
45
+
46
+ def body
47
+ @message.getContentAsString()
48
+ end
6
49
 
7
50
  end
51
+
8
52
  end
9
53
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: stilts-stomp-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.4
5
+ version: 0.1.5
6
6
  platform: java
7
7
  authors:
8
8
  - The Stilts Team
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-28 00:00:00 -04:00
13
+ date: 2011-07-29 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -33,9 +33,6 @@ files:
33
33
  - lib/stilts-stomp-common.jar
34
34
  - lib/commons-lang-2.6.jar
35
35
  - lib/gem_hook.rb
36
- - lib/stilts-stomp-api-0.1.3.jar
37
- - lib/stilts-stomp-client-0.1.3.jar
38
- - lib/stilts-stomp-common-0.1.3.jar
39
36
  - lib/stilts/stomp/client.rb
40
37
  has_rdoc: true
41
38
  homepage: http://www.jboss.org/stilts-stomp-client/
Binary file
Binary file
Binary file