Add more robust notification service config
Enables canvas to connect to local service queue by allowing other AWS SQS keys to be passed into main config. Test Plan: * Start notification service * Start canvas jobs with notification failures configured for local * copy `config/notification_failures.yml.example` to `config/notification_failures.yml` * modify `notification_failures.yml` to include sqs_endpoint info ``` development: notification_failure_queue_name: notification-service-failures use_ssl: false sqs_endpoint: sqs.docker sqs_port: 9494 access_key_id: access key id secret_access_key: secret access key ``` * Start canvas with notification service configured for local * copy `config/notification_service.yml.example` to `config/notification_service.yml` * modify `notification_service.yml` to include sqs_endpoint info ``` development: notification_service_queue_name: notification-service use_ssl: false sqs_endpoint: sqs.docker sqs_port: 9494 access_key_id: access key id secret_access_key: secret access key ``` * Enable notification service in rails console * `User.find(1).account.root_account.enable_feature!(:notification_service)` * Add bad email communication channel to a canvas user * Settings -> Add email address 'baduserwithoutdomain@example.com' * Confirm communication channel `CommunicationChannel.last.confirm!` * Modify email address to remove domain * `CommunicationChannel.last.update_attribute(:path, 'baduserwithoutdomain')` * Change default email address to bogus one * Settings -> email addresses -> click star next to "baduser..." * Send message with different account to account with "baduser" email * Confirm that message is set to "transmission_error" state from notifications admin tools * Additionally, "transmission_errors" field can be checked on message record in rails console to see actual error message closes CNVS-27199 Change-Id: I5a6b00f86544dba15598dd1f692524253af42be2 Reviewed-on: https://gerrit.instructure.com/71971 Reviewed-by: Steven Burnett <sburnett@instructure.com> Tested-by: Jenkins QA-Review: Gentry Beckmann <gbeckmann@instructure.com> Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
This commit is contained in:
parent
7f883439e6
commit
010d1be0e6
|
@ -19,6 +19,9 @@
|
|||
require 'aws-sdk'
|
||||
|
||||
class NotificationService
|
||||
DEFAULT_CONFIG = {
|
||||
notification_service_queue_name: 'notification-service'
|
||||
}.freeze
|
||||
|
||||
def self.process(global_id, body, type, to, remote)
|
||||
self.notification_queue.send_message({
|
||||
|
@ -32,11 +35,8 @@ class NotificationService
|
|||
|
||||
def self.notification_queue
|
||||
return @notification_queue if defined?(@notification_queue)
|
||||
@config ||= ConfigFile.load('notification_service').try(:symbolize_keys)
|
||||
sqs = AWS::SQS.new(
|
||||
access_key_id: @config[:access_key_id],
|
||||
secret_access_key: @config[:secret_access_key],
|
||||
region: @config[:region])
|
||||
@notification_queue = sqs.queues.named(@config[:notification_service_name])
|
||||
@config ||= DEFAULT_CONFIG.merge(ConfigFile.load('notification_service').try(:symbolize_keys))
|
||||
sqs = AWS::SQS.new(@config)
|
||||
@notification_queue = sqs.queues.named(@config[:notification_service_queue_name])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
development:
|
||||
access_key_id: access_key
|
||||
secret_access_key: secret_key
|
||||
# notification_failure_queue_name: notification_service_failures
|
||||
# notification_failure_queue_name: notification-service-failures
|
||||
# idle_timeout: 10
|
||||
# You can also specify the following values to be passed into the sqs queue's
|
||||
# poll command: initial_timeout, wait_time_seconds, visibility_timeout
|
||||
# poll command: initial_timeout, wait_time_seconds, visibility_timeout
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
development:
|
||||
access_key_id: access_key
|
||||
secret_access_key: secret_key
|
||||
# notification_service_queue_name: notification-service
|
Loading…
Reference in New Issue