Sha256: 0cf93770bf09a25d5a4047f7a591761230061fc4c184bf5bd317bc08768211f1

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

module Shamu
  module Events

    # The event {Message} consists of a set of well-defined attributes
    # describing a single discrete event in the system and associated meta-data
    # needed by subscribers to process the message.
    #
    # Messages should attempt to forward the state available at the time the
    # event was published so that subscribers can process the message without
    # contacting additional services.
    #
    # Event messages are  serialized for network or IPC transimission and must
    # limit attributes to primitive types (Strings, Numbers, Arrays and Hashes)
    # so they can be round tripped with `Message.new( message.to_attributes )`.
    class Message
      include Shamu::Attributes
      include Shamu::Attributes::Equality

      # ============================================================================
      # @!group Attributes
      #

      # @!attribute
      # @return [String] the ID for the message. Automatically generated UUID
        attribute :id

      #
      # @!endgroup Attributes


      def initialize( * )
        super

        @id ||= SecureRandom.uuid
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shamu-0.0.24 lib/shamu/events/message.rb
shamu-0.0.21 lib/shamu/events/message.rb
shamu-0.0.20 lib/shamu/events/message.rb
shamu-0.0.19 lib/shamu/events/message.rb
shamu-0.0.18 lib/shamu/events/message.rb
shamu-0.0.17 lib/shamu/events/message.rb
shamu-0.0.15 lib/shamu/events/message.rb
shamu-0.0.14 lib/shamu/events/message.rb
shamu-0.0.13 lib/shamu/events/message.rb
shamu-0.0.11 lib/shamu/events/message.rb
shamu-0.0.9 lib/shamu/events/message.rb
shamu-0.0.8 lib/shamu/events/message.rb
shamu-0.0.7 lib/shamu/events/message.rb
shamu-0.0.5 lib/shamu/events/message.rb
shamu-0.0.4 lib/shamu/events/message.rb
shamu-0.0.3 lib/shamu/events/message.rb
shamu-0.0.2 lib/shamu/events/message.rb