Class: EventQ::Amazon::EventQClient
- Inherits:
-
Object
- Object
- EventQ::Amazon::EventQClient
- Defined in:
- lib/eventq_aws/aws_eventq_client.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ EventQClient
constructor
A new instance of EventQClient.
- #new_message ⇒ Object
- #raise_event(event_type, event) ⇒ Object
Constructor Details
#initialize(options) ⇒ EventQClient
Returns a new instance of EventQClient.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/eventq_aws/aws_eventq_client.rb', line 5 def initialize() if [:client] == nil raise ':client (QueueClient) must be specified.'.freeze end @client = [:client] @serialization_manager = EventQ::SerializationProviders::Manager.new end |
Instance Method Details
#new_message ⇒ Object
43 44 45 |
# File 'lib/eventq_aws/aws_eventq_client.rb', line 43 def EventQ::QueueMessage.new end |
#raise_event(event_type, event) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/eventq_aws/aws_eventq_client.rb', line 17 def raise_event(event_type, event) _event_type = EventQ.create_event_type(event_type) topic_arn = @client.get_topic_arn(_event_type) qm = qm.content = event qm.type = _event_type serialization_provider = @serialization_manager.get_provider(EventQ::Configuration.serialization_provider) = serialization_provider.serialize(qm) response = @client.sns.publish({ topic_arn: topic_arn, message: , subject: event_type }) EventQ.log(:debug, "[#{self.class}] - Raised event. Message: #{} | Type: #{event_type}.") return response. end |