Class: Pubsub::Redis::DomainEventPublisher

Inherits:
DomainEventPublisher
  • Object
show all
Defined in:
lib/pubsub/redis.rb

Instance Method Summary collapse

Constructor Details

#initialize(redis_client, serializer, channel) ⇒ DomainEventPublisher

Returns a new instance of DomainEventPublisher.



8
9
10
11
12
# File 'lib/pubsub/redis.rb', line 8

def initialize(redis_client, serializer, channel)
  @redis_client = redis_client
  @serializer = serializer
  @channel = channel
end

Instance Method Details

#publish(domain_event) ⇒ Object



14
15
16
17
# File 'lib/pubsub/redis.rb', line 14

def publish(domain_event)
  @redis_client.publish(@channel,
                        @serializer.serialize(domain_event.to_h))
end