-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add subscriber name as suffix for executable container keys (#108)
* Add subscriber name as suffix for executable container keys * added specs
- Loading branch information
Showing
6 changed files
with
294 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
spec/rails_app/app/event_source/subscribers/enterprise_subscriber.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Subscribers | ||
# Subscriber will receive Enterprise requests like date change | ||
class EnterpriseSubscriber | ||
include ::EventSource::Subscriber[amqp: "enroll.enterprise.events"] | ||
|
||
subscribe(:on_date_advanced) do |delivery_info, metadata, response| | ||
logger.info "-" * 100 unless Rails.env.test? | ||
logger.info "EnterpriseSubscriber#on_date_advanced, response: #{response}" | ||
|
||
ack(delivery_info.delivery_tag) | ||
rescue StandardError, SystemStackError => e | ||
ack(delivery_info.delivery_tag) | ||
end | ||
|
||
subscribe( | ||
:on_enroll_enterprise_events | ||
) do |delivery_info, _metadata, response| | ||
logger.info "-" * 100 unless Rails.env.test? | ||
logger.info "EnterpriseSubscriber#on_enroll_enterprise_events, response: #{response}" | ||
|
||
ack(delivery_info.delivery_tag) | ||
rescue StandardError, SystemStackError => e | ||
ack(delivery_info.delivery_tag) | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
spec/rails_app/app/event_source/subscribers/event_log_subscriber.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module Subscribers | ||
# Subscriber will receive Audit Log events | ||
class EventLogSubscriber | ||
include EventSource::Logging | ||
include ::EventSource::Subscriber[amqp: "enroll.audit_log.events"] | ||
|
||
subscribe( | ||
:on_enroll_audit_log_events | ||
) do |delivery_info, metadata, response| | ||
logger.info "-" * 100 unless Rails.env.test? | ||
|
||
subscriber_logger.info "EventLogEventsSubscriber#on_enroll_audit_log_events, response: #{response}" | ||
|
||
ack(delivery_info.delivery_tag) | ||
rescue StandardError, SystemStackError => e | ||
ack(delivery_info.delivery_tag) | ||
end | ||
|
||
private | ||
|
||
def subscriber_logger | ||
@subscriber_logger ||= | ||
Logger.new("#{Rails.root}/log/on_enroll_audit_log_events.log") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
asyncapi: 2.0.0 | ||
info: | ||
title: Enroll App | ||
version: 0.1.0 | ||
description: AMQP Subsribe configuration for the Enroll App services | ||
contact: | ||
name: IdeaCrew | ||
url: https://ideacrew.com | ||
email: info@ideacrew.com | ||
license: | ||
name: MIT | ||
url: https://opensource.org/licenses/MIT | ||
|
||
servers: | ||
production: | ||
url: "amqp://rabbitmq:5672/event_source" | ||
protocol: :amqp | ||
protocolVersion: "0.9.2" | ||
description: RabbitMQ Production Server | ||
development: | ||
url: "amqp://rabbitmq:5672/event_source" | ||
protocol: :amqp | ||
protocolVersion: "0.9.2" | ||
description: RabbitMQ Test Server | ||
test: | ||
url: "amqp://rabbitmq:5672/event_source" | ||
protocol: :amqp | ||
protocolVersion: "0.9.2" | ||
description: RabbitMQ Test Server | ||
channels: | ||
on_enroll.enroll.enterprise.events: | ||
bindings: | ||
amqp: | ||
is: queue | ||
queue: | ||
name: on_enroll.enroll.enterprise.events | ||
durable: true | ||
exclusive: false | ||
auto_delete: false | ||
vhost: "/" | ||
subscribe: | ||
bindings: | ||
amqp: | ||
ack: true | ||
exclusive: false | ||
routing_key: enroll.# | ||
prefetch: 1 | ||
bindingVersion: "0.2.0" | ||
operationId: on_enroll.enroll.enterprise.events | ||
description: Events - for system wide changes | ||
|
||
tags: | ||
- name: linter_tag | ||
description: placeholder that satisfies the linter |