iachat/app/dispatchers/async_dispatcher.rb
Gabriel Jablonski 62ef2113d5
feat: toggle typing status on channel provider (#39)
* feat: toggle typing status on channel provider

* refactor: general refactorings

* fix: check if channel implements method

* test: channel listener specs

* test: channel spec

* test: baileys service spec
2025-05-03 00:39:39 -03:00

28 lines
777 B
Ruby

class AsyncDispatcher < BaseDispatcher
def dispatch(event_name, timestamp, data)
EventDispatcherJob.perform_later(event_name, timestamp, data)
end
def publish_event(event_name, timestamp, data)
event_object = Events::Base.new(event_name, timestamp, data)
publish(event_object.method_name, event_object)
end
def listeners
[
AutomationRuleListener.instance,
CampaignListener.instance,
CsatSurveyListener.instance,
HookListener.instance,
InstallationWebhookListener.instance,
NotificationListener.instance,
ParticipationListener.instance,
ReportingEventListener.instance,
WebhookListener.instance,
ChannelListener.instance
]
end
end
AsyncDispatcher.prepend_mod_with('AsyncDispatcher')