undefined method `publisher_config' for Circuitry:Module
Trying to demo Circuitry in my app, so using the config in the example app I created a file circuitry.rb in the initializers folder, it has the following content as copied from the example app
require 'circuitry'
Circuitry.publisher_config do |c|
c.access_key = ENV.fetch('AWS_ACCESS_KEY')
c.secret_key = ENV.fetch('AWS_SECRET_KEY')
c.region = ENV.fetch('AWS_REGION')
c.logger = Rails.logger
c.async_strategy = :thread
c.on_async_exit = proc do
puts 'Publisher done.'
end
# list of topics that will be published to
c.topic_names = %w[
example-circuitry-topic
]
end
Circuitry.subscriber_config do |c|
c.access_key = ENV.fetch('AWS_ACCESS_KEY')
c.secret_key = ENV.fetch('AWS_SECRET_KEY')
c.region = ENV.fetch('AWS_REGION')
c.async_strategy = :thread
c.on_async_exit = proc do
puts 'Subscriber done.'
end
c.queue_name = 'example-circuitry-queue'
# list of topics that the queue should subscribe to
c.topic_names = %w[
example-circuitry-topic
]
end
created these 2 other files in the config folder subscriber.rb
require_relative './initializers/circuitry'
Circuitry.subscribe(async: true) do |message, topic|
puts "Received: #{topic}: #{message.inspect}"
end
and publisher.rb
require_relative './initializers/circuitry'
topic = 'example-circuitry-topic'
10.times do |n|
# `object` can be anything that responds to `#to_json`.
object = { foo: 'bar', fizz: 'buzz', n: n }
Circuitry.publish(topic, object, async: true)
end
Circuitry.flush
My app is not stating up because of this error and I have no idea how to fix.
web_1 | rake aborted!
web_1 | NoMethodError: undefined method `publisher_config' for Circuitry:Module
web_1 | Did you mean? public_send
web_1 | /conectar/config/initializers/circuitry.rb:3:in `<main>'
Any idea how to fix this error?
What version of circuitry are you using? There used to only be a single config method prior to 3.0.0. 8235ce4d6dbc8375feef3a3a198bbaf3f7023cec
@mhuggins i'm using the latest version v3.2.0
Can you publish a small sample app on GitHub that reproduces the issue? Have never run into this, and the example code you provided works for me.