Sha256: 50e98084e6c72bcff4b8de37349785646697815e6f689722f79cac4038ec6a5a

Contents?: true

Size: 625 Bytes

Versions: 8

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

module Deimos
  # Store Kafka messages into the database.
  class KafkaMessage < ActiveRecord::Base
    self.table_name = 'kafka_messages'

    validates_presence_of :message, :topic

    # Ensure it gets turned into a string, e.g. for testing purposes. It
    # should already be a string.
    # @param mess [Object]
    def message=(mess)
      write_attribute(:message, mess.to_s)
    end

    # @return [Hash]
    def phobos_message
      {
        payload: self.message,
        partition_key: self.partition_key,
        key: self.key,
        topic: self.topic
      }
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
deimos-ruby-1.0.0.pre.beta22 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta21 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta20 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta19 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta18 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta17 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta16 lib/deimos/kafka_message.rb
deimos-kafka-1.0.0.pre.beta15 lib/deimos/kafka_message.rb