garaio_bunny 2.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +231 -0
  3. data/lib/amq/protocol/extensions.rb +16 -0
  4. data/lib/bunny/authentication/credentials_encoder.rb +55 -0
  5. data/lib/bunny/authentication/external_mechanism_encoder.rb +27 -0
  6. data/lib/bunny/authentication/plain_mechanism_encoder.rb +19 -0
  7. data/lib/bunny/channel.rb +2055 -0
  8. data/lib/bunny/channel_id_allocator.rb +82 -0
  9. data/lib/bunny/concurrent/atomic_fixnum.rb +75 -0
  10. data/lib/bunny/concurrent/condition.rb +66 -0
  11. data/lib/bunny/concurrent/continuation_queue.rb +62 -0
  12. data/lib/bunny/concurrent/linked_continuation_queue.rb +61 -0
  13. data/lib/bunny/concurrent/synchronized_sorted_set.rb +56 -0
  14. data/lib/bunny/consumer.rb +128 -0
  15. data/lib/bunny/consumer_tag_generator.rb +23 -0
  16. data/lib/bunny/consumer_work_pool.rb +122 -0
  17. data/lib/bunny/cruby/socket.rb +110 -0
  18. data/lib/bunny/cruby/ssl_socket.rb +118 -0
  19. data/lib/bunny/delivery_info.rb +93 -0
  20. data/lib/bunny/exceptions.rb +269 -0
  21. data/lib/bunny/exchange.rb +275 -0
  22. data/lib/bunny/framing.rb +56 -0
  23. data/lib/bunny/get_response.rb +83 -0
  24. data/lib/bunny/heartbeat_sender.rb +71 -0
  25. data/lib/bunny/jruby/socket.rb +57 -0
  26. data/lib/bunny/jruby/ssl_socket.rb +58 -0
  27. data/lib/bunny/message_properties.rb +119 -0
  28. data/lib/bunny/queue.rb +393 -0
  29. data/lib/bunny/reader_loop.rb +158 -0
  30. data/lib/bunny/return_info.rb +74 -0
  31. data/lib/bunny/session.rb +1483 -0
  32. data/lib/bunny/socket.rb +14 -0
  33. data/lib/bunny/ssl_socket.rb +14 -0
  34. data/lib/bunny/test_kit.rb +41 -0
  35. data/lib/bunny/timeout.rb +7 -0
  36. data/lib/bunny/transport.rb +526 -0
  37. data/lib/bunny/version.rb +6 -0
  38. data/lib/bunny/versioned_delivery_tag.rb +28 -0
  39. data/lib/bunny.rb +92 -0
  40. metadata +127 -0
@@ -0,0 +1,74 @@
1
+ module Bunny
2
+ # Wraps AMQ::Protocol::Basic::Return to
3
+ # provide access to the delivery properties as immutable hash as
4
+ # well as methods.
5
+ class ReturnInfo
6
+
7
+ #
8
+ # Behaviors
9
+ #
10
+
11
+ include Enumerable
12
+
13
+ #
14
+ # API
15
+ #
16
+
17
+ def initialize(basic_return)
18
+ @basic_return = basic_return
19
+ @hash = {
20
+ :reply_code => basic_return.reply_code,
21
+ :reply_text => basic_return.reply_text,
22
+ :exchange => basic_return.exchange,
23
+ :routing_key => basic_return.routing_key
24
+ }
25
+ end
26
+
27
+ # Iterates over the returned delivery properties
28
+ # @see Enumerable#each
29
+ def each(*args, &block)
30
+ @hash.each(*args, &block)
31
+ end
32
+
33
+ # Accesses returned delivery properties by key
34
+ # @see Hash#[]
35
+ def [](k)
36
+ @hash[k]
37
+ end
38
+
39
+ # @return [Hash] Hash representation of this returned delivery info
40
+ def to_hash
41
+ @hash
42
+ end
43
+
44
+ # @private
45
+ def to_s
46
+ to_hash.to_s
47
+ end
48
+
49
+ # @private
50
+ def inspect
51
+ to_hash.inspect
52
+ end
53
+
54
+ # @return [Integer] Reply (status) code of the cause
55
+ def reply_code
56
+ @basic_return.reply_code
57
+ end
58
+
59
+ # @return [Integer] Reply (status) text of the cause, explaining why the message was returned
60
+ def reply_text
61
+ @basic_return.reply_text
62
+ end
63
+
64
+ # @return [String] Exchange the message was published to
65
+ def exchange
66
+ @basic_return.exchange
67
+ end
68
+
69
+ # @return [String] Routing key the message has
70
+ def routing_key
71
+ @basic_return.routing_key
72
+ end
73
+ end
74
+ end