diff --git a/Gemfile b/Gemfile index 39e50360..395fa377 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ ruby '2.7.6' gem 'mitc_service', path: 'components/mitc_service' gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', branch: 'trunk' -gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'trunk' +gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'wait_for_rails_start' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.3' diff --git a/Gemfile.lock b/Gemfile.lock index 70836090..0ef05c60 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,10 +18,10 @@ GIT GIT remote: https://github.com/ideacrew/event_source.git - revision: 29393ebb04df8f57ccb536da4635087c8c8bde0b - branch: trunk + revision: 3a159e0ace4889bb9652752cd62fade1d153275f + branch: wait_for_rails_start specs: - event_source (0.5.5) + event_source (0.5.8) bunny (>= 2.14) deep_merge (~> 1.2.0) dry-events (~> 0.3) diff --git a/app/event_source/subscribers/mitc_response_subscriber.rb b/app/event_source/subscribers/mitc_response_subscriber.rb index 00e607df..5f4bf2b7 100644 --- a/app/event_source/subscribers/mitc_response_subscriber.rb +++ b/app/event_source/subscribers/mitc_response_subscriber.rb @@ -13,6 +13,12 @@ class MitcResponseSubscriber # # @return [success/failure message] subscribe(:on_determinations_eval) do |body, status, headers| + @subscriber_logger = Logger.new( + File.join(Rails.root, 'log', "mitc_response_subscriber_#{Date.today.strftime('%Y_%m_%d')}.log") + ) + @subscriber_logger.info '-' * 100 + @subscriber_logger.info "MitcResponseSubscriber#on_determinations_eval body: #{body}, status: #{status}, headers: #{headers}" + logger.info "MitcResponseSubscriber#on_determinations_eval body: #{body}, status: #{status}, headers: #{headers}" correlation_id = headers["CorrelationID"] persist(body, correlation_id) @@ -22,8 +28,12 @@ def self.persist(response, correlation_id) logger.info "MitcResponseSubscriber response: #{response}, response_class: #{response.class}" params = { medicaid_application_id: correlation_id, medicaid_response_payload: response } + @subscriber_logger.info "MitcResponseSubscriber#persist params: #{params}" + result = Eligibilities::DetermineFullEligibility.new.call(params.deep_symbolize_keys!) + @subscriber_logger.info "MitcResponseSubscriber#persist result: #{result.inspect}" + message = if result.success? result.success else diff --git a/components/mitc_service/Gemfile b/components/mitc_service/Gemfile index b979c331..2e9afa21 100644 --- a/components/mitc_service/Gemfile +++ b/components/mitc_service/Gemfile @@ -10,7 +10,7 @@ gemspec # gem 'byebug', group: [:development, :test] gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', branch: 'trunk' -gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'trunk' +gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', branch: 'wait_for_rails_start' group :development, :test do gem "rspec-rails" diff --git a/components/mitc_service/Gemfile.lock b/components/mitc_service/Gemfile.lock index 86fe092a..c52a99ec 100644 --- a/components/mitc_service/Gemfile.lock +++ b/components/mitc_service/Gemfile.lock @@ -17,10 +17,10 @@ GIT GIT remote: https://github.com/ideacrew/event_source.git - revision: 29393ebb04df8f57ccb536da4635087c8c8bde0b - branch: trunk + revision: 3a159e0ace4889bb9652752cd62fade1d153275f + branch: wait_for_rails_start specs: - event_source (0.5.5) + event_source (0.5.8) bunny (>= 2.14) deep_merge (~> 1.2.0) dry-events (~> 0.3) diff --git a/components/mitc_service/spec/dummy/config/initializers/event_source.rb b/components/mitc_service/spec/dummy/config/initializers/event_source.rb new file mode 100644 index 00000000..a2c4ee7d --- /dev/null +++ b/components/mitc_service/spec/dummy/config/initializers/event_source.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +EventSource.configure do |config| + config.protocols = %w[amqp http] +end diff --git a/config/initializers/event_source.rb b/config/initializers/event_source.rb index f4c32167..707aeafb 100644 --- a/config/initializers/event_source.rb +++ b/config/initializers/event_source.rb @@ -65,4 +65,4 @@ end end -EventSource.initialize! \ No newline at end of file +# EventSource.initialize!