Class: SubscriptionsConfig
- Inherits:
-
Object
- Object
- SubscriptionsConfig
- Defined in:
- lib/subscriptions-config.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ hostname: 'localhost', message_bus_type: 'IbmMQ', exchange: 'dataDelivery', routing_spec: "", queue_base: "", durable: false, model: "", extension: "", port: "1414", trace_level: "0", credentials: "", vhost: "", keep_queue: "n", sub_name: "" }.freeze
Instance Method Summary collapse
- #create! ⇒ Object
- #delete! ⇒ Object
-
#initialize(config) ⇒ SubscriptionsConfig
constructor
A new instance of SubscriptionsConfig.
- #show_bindings ⇒ Object
- #show_environment ⇒ Object
- #show_keep_queue ⇒ Object
- #show_sub_name ⇒ Object
- #show_topics ⇒ Object
- #subscription_name(queue_name, routing_key) ⇒ Object
Constructor Details
#initialize(config) ⇒ SubscriptionsConfig
Returns a new instance of SubscriptionsConfig.
21 22 23 |
# File 'lib/subscriptions-config.rb', line 21 def initialize(config) @config = DEFAULT_CONFIG.merge(config) end |
Instance Method Details
#create! ⇒ Object
25 26 27 28 29 |
# File 'lib/subscriptions-config.rb', line 25 def create! create_rabbitmq! if == 'RabbitMQ' create_ibmmq! if == 'IbmMQ' self end |
#delete! ⇒ Object
31 32 33 34 35 |
# File 'lib/subscriptions-config.rb', line 31 def delete! delete_rabbit! if == 'RabbitMQ' delete_ibmmq! if == 'IbmMQ' self end |
#show_bindings ⇒ Object
42 43 44 45 |
# File 'lib/subscriptions-config.rb', line 42 def show_bindings puts bindings self end |
#show_environment ⇒ Object
47 48 49 50 51 52 |
# File 'lib/subscriptions-config.rb', line 47 def show_environment puts "Bus Type: #{}" show_environment_ibmmq if == 'IbmMQ' show_environment_rabbit if == 'RabbitMQ' self end |
#show_keep_queue ⇒ Object
63 64 65 66 |
# File 'lib/subscriptions-config.rb', line 63 def show_keep_queue puts keep_queue self end |
#show_sub_name ⇒ Object
68 69 70 71 |
# File 'lib/subscriptions-config.rb', line 68 def show_sub_name puts sub_name self end |
#show_topics ⇒ Object
37 38 39 40 |
# File 'lib/subscriptions-config.rb', line 37 def show_topics puts topics self end |
#subscription_name(queue_name, routing_key) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/subscriptions-config.rb', line 54 def subscription_name(queue_name, routing_key) if sub_name.nil? routing_key_digest = Digest::SHA1.hexdigest(routing_key)[0..8] "#{queue_name}.#{routing_key_digest}" else sub_name end end |