Skip to content

Conversation

@timurvafin
Copy link
Contributor

Example how to implement notification system using multiple delivery system.
In out example we use Email and Hipchat.

There are two main things to learn:

  • SendFeedback interactor — the entry point
  • FeedbackNotification model — class to generate content of different type of notifications

Example how to implement notification system using multiple delivery system.
In out example we use Email and Hipchat.

There are two main things to learn:
* SendFeedback interactor — the entry point
* FeedbackNotification model — class to generate content of different type of notifications
private

def email
context.feedback.employee.email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here is the violation of law of demeter. Probably, we can delegate email to feedback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArturMinnullin something like this?

delegate :email, to: context.feedback.employee

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timurvafin Yeap 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArturMinnullin check this out 603cecd

gem "hipchat"
gem "interactor"
gem "render_anywhere"
gem "sidekiq"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to metion here that If sidekiq has not been added and configured before implementing this feature then it is required to set sidekiq as active job queue adapter in config/application.rb

# config/application.rb
# ...
  class Application < Rails::Application
    # ...
    config.active_job.queue_adapter = :sidekiq
    # ...
  end
# ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants