Sha256: b71a333459336e36c7e7e11970907e1e7bf70f4c19874015393df55270d47195

Contents?: true

Size: 652 Bytes

Versions: 26

Compression:

Stored size: 652 Bytes

Contents

module Euston
  module EventStore
    # Represents a single element in a stream of events.
    class EventMessage

      def initialize(arg = nil)
        if arg.is_a?(Hash) && (arg.keys & ['body','headers']).size == 2
          @body, @headers = arg.values_at('body','headers')
        else
          @headers = {}
          @body = arg
        end
      end

      def to_hash
        {:headers=>@headers,:body=>@body}
      end

      # Gets the metadata which provides additional, unstructured information about this message.
      attr_reader :headers

      # Gets or sets the actual event message body.
      attr_reader :body
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
euston-eventstore-1.2.7 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.7-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.6 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.6-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.5-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.5 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.4 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.4-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.3 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.3-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.2 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.2-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.1-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.1 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.0 lib/euston-eventstore/event_message.rb
euston-eventstore-1.2.0-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.1.0 lib/euston-eventstore/event_message.rb
euston-eventstore-1.1.0-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.0.4-java lib/euston-eventstore/event_message.rb
euston-eventstore-1.0.4 lib/euston-eventstore/event_message.rb