Sha256: 165ee8303c8e8a1943a2eab1fea23b2dc6b2b1123185395d3c797425e0475d7e

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

#!/usr/bin/env railsrunner

gem 'eventbus'
require 'eventbus/service'
require 'eventbus/message'

class EmailRequest < EventBus::Message
  def initialize
    super("EVENT_BUS_CORE")
  end
  
  def contents
    get("web_message")
  end
end


class EmailService < EventBus::Service
  
  def initialize
    super("EVENT_BUS_CORE")
    self.listen_queue = "email"
  end
  

  def process_message(incoming_msg)
    
    msg = EmailRequest.new
    msg.load(incoming_msg[:payload])
    
    puts "Sending email with contents:"
    puts msg.contents
    
    msg.status = "EMAIL_SENT"
    msg.send
    
  end

end

EmailService.new.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eventbus-0.0.20 bin/eventbus_emailer.rb