Update examples

This commit is contained in:
2017-10-24 01:10:51 +01:00
parent 899ad6bdb6
commit 743efbf647
10 changed files with 36 additions and 16 deletions

View File

@@ -1,5 +1,8 @@
require 'foobar/consumers'
require 'foobar/version'
# frozen_string_literal: true
require 'foobar/application'
require 'foobar/ping_consumer'
require 'foobar/pong_consumer'
module Foobar
end

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
require 'foobar/version'
module Foobar
class Application < BunnyRun::Application
name 'foobar'
usage '<options> [<path>]'
version Foobar::VERSION
option :success_message, 'Message to log after success',
type: :string, default: ENV['MESSAGE']
end
end

View File

@@ -1,2 +0,0 @@
require 'foobar/ping_consumer'
require 'foobar/pong_consumer'

View File

@@ -17,7 +17,9 @@ module Foobar
publish('ping-pong', 'PONG', routing_key: 'pong')
message.ack
logger.info
return unless options[:success_message]
logger.info("#{self.class}: #{options[:success_message]}")
end
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'bunnyrun'
module Foobar
@@ -15,6 +17,9 @@ module Foobar
publish('ping-pong', 'PING', routing_key: 'ping')
message.ack
return unless options[:success_message]
logger.info("#{self.class}: #{options[:success_message]}")
end
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
module Foobar
VERSION = '0.1.0'.freeze
VERSION = '0.1.0'
end