module Onyx::EDA::Consumer(T)

Overview

A module which would make an including object an event consumer. Consumption differs from subscription in a way that only a single consumption instance with certain ID would be notified about an event. In this module, consumer ID equals to the including object class name.

This module behaves a lot like Subscriber, see its docs for details.

Included Modules

Defined in:

onyx-eda/consumer.cr

Instance Method Summary

Instance methods inherited from module Onyx::EDA::Actor

subscribe(channel : Onyx::EDA::Channel) : self subscribe, unsubscribe(channel : Onyx::EDA::Channel) : self unsubscribe

Instance Method Detail

abstract def handle(event : T) #

Handle incoming event. Must be defined explicitly in a consumer.

TODO Find a way to enable per-event custom ID.


[View source]