Sha256: 0cfe538620a02559aa37770ea389b6fd9c8007f01a6e0d965931f6ec6db4e3aa
Contents?: true
Size: 713 Bytes
Versions: 12
Compression:
Stored size: 713 Bytes
Contents
# frozen_string_literal: true module Eventboss class Publisher def initialize(event_name, sns_client, configuration, opts = {}) @event_name = event_name @sns_client = sns_client @configuration = configuration @source = configuration.eventboss_app_name unless opts[:generic] end def publish(payload) topic_arn = Topic.build_arn(event_name: event_name, source_app: source) sns_client.publish( topic_arn: topic_arn, message: json_payload(payload) ) end private attr_reader :event_name, :sns_client, :configuration, :source def json_payload(payload) payload.is_a?(String) ? payload : payload.to_json end end end
Version data entries
12 entries across 12 versions & 1 rubygems