Class: PostcardRB
- Inherits:
-
Object
- Object
- PostcardRB
- Defined in:
- lib/postcard_rb.rb
Instance Method Summary collapse
- #connect ⇒ Object
- #createTopic(name:, routing:) ⇒ Object
-
#initialize(dispatcher:) ⇒ PostcardRB
constructor
A new instance of PostcardRB.
Constructor Details
#initialize(dispatcher:) ⇒ PostcardRB
Returns a new instance of PostcardRB.
4 5 6 7 8 9 |
# File 'lib/postcard_rb.rb', line 4 def initialize dispatcher: @CONNECTION_RETRIES = 10 @CONNECTION_INTERVAL = 2 @dispatcher = dispatcher end |
Instance Method Details
#connect ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/postcard_rb.rb', line 11 def connect begin @dispatcher.connect( connectionInterval: @CONNECTION_INTERVAL, connectionRetries: @CONNECTION_RETRIES ) rescue DispatcherConnectionRefused raise PostcardConnectionRefused end end |
#createTopic(name:, routing:) ⇒ Object
22 23 24 25 26 |
# File 'lib/postcard_rb.rb', line 22 def createTopic name:, routing: topic = @dispatcher.createTopic(name: name, routing: routing) return topic end |