Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev test auto scaling #417

Draft
wants to merge 9 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions app/event_source/subscribers/mitc_response_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/mitc_service/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions components/mitc_service/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

EventSource.configure do |config|
config.protocols = %w[amqp http]
end
2 changes: 1 addition & 1 deletion config/initializers/event_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
end
end

EventSource.initialize!
# EventSource.initialize!
Loading