mirror of
https://github.com/jimeh/bunnyrun.git
synced 2026-02-19 07:56:40 +00:00
Update examples
This commit is contained in:
@@ -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
|
||||
|
||||
14
examples/application-example/lib/foobar/application.rb
Normal file
14
examples/application-example/lib/foobar/application.rb
Normal 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
|
||||
@@ -1,2 +0,0 @@
|
||||
require 'foobar/ping_consumer'
|
||||
require 'foobar/pong_consumer'
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Foobar
|
||||
VERSION = '0.1.0'.freeze
|
||||
VERSION = '0.1.0'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user