Rill v0.10.4 Rill.Messaging.Message View Source

Link to this section Summary

Functions

Provides defstruct/1 macro which allows creation of struct with required message keys (:id, :metadata)

Builds struct for struct_name

Builds struct for struct_name

Builds struct for struct_name with correlation_stream_name set

Behaves like defstruct/1, but doesn't allow to use attributes named :id or :metadata (reserved). The attribute :id is automatically defined with default nil. The attribute :metadata is automatically defined with default %Rill.Messaging.Message.Metadata{}

Link to this section Types

Link to this type

copy_opts() View Source
copy_opts() ::
  {:metadata,
   nil
   | %Rill.Messaging.Message.Metadata{
       causation_message_global_position: term(),
       causation_message_position: term(),
       causation_message_stream_name: term(),
       correlation_stream_name: term(),
       global_position: term(),
       position: term(),
       reply_stream_name: term(),
       schema_version: term(),
       stream_name: term(),
       time: term()
     }}

Link to this type

message_or_type() View Source
message_or_type() :: String.t() | atom() | struct()

Link to this section Functions

Link to this macro

__using__(opts \\ []) View Source (macro)

Provides defstruct/1 macro which allows creation of struct with required message keys (:id, :metadata)

Link to this function

build(struct_name, message_data) View Source
build(
  struct_name :: module(),
  message_data :: %Rill.MessageStore.MessageData.Read{
    data: term(),
    global_position: term(),
    id: term(),
    metadata: term(),
    position: term(),
    stream_name: term(),
    time: term(),
    type: term()
  }
) :: struct()

Builds struct for struct_name

Link to this function

build(struct_name, data \\ nil, metadata \\ nil) View Source
build(struct_name :: module(), data :: map(), metadata :: map()) :: struct()

Builds struct for struct_name

Link to this function

build_metadata(metadata) View Source
build_metadata(
  metadata ::
    %Rill.Messaging.Message.Metadata{
      causation_message_global_position: term(),
      causation_message_position: term(),
      causation_message_stream_name: term(),
      correlation_stream_name: term(),
      global_position: term(),
      position: term(),
      reply_stream_name: term(),
      schema_version: term(),
      stream_name: term(),
      time: term()
    }
    | nil
) :: %Rill.Messaging.Message.Metadata{
  causation_message_global_position: term(),
  causation_message_position: term(),
  causation_message_stream_name: term(),
  correlation_stream_name: term(),
  global_position: term(),
  position: term(),
  reply_stream_name: term(),
  schema_version: term(),
  stream_name: term(),
  time: term()
}

Link to this function

canonize_name(name) View Source
canonize_name(name :: String.t()) :: String.t()

Link to this function

copy(source, receiver, opts \\ []) View Source
copy(source :: struct(), receiver :: struct(), opts :: [copy_opts()]) ::
  struct()

Link to this function

correlate(struct_name, correlation_stream_name) View Source
correlate(
  struct_name :: module(),
  correlation_stream_name :: Rill.MessageStore.StreamName.t()
) :: struct()
correlate(
  message :: struct(),
  correlation_stream_name :: Rill.MessageStore.StreamName.t()
) :: struct()

Builds struct for struct_name with correlation_stream_name set

Link to this macro

defstruct(attrs) View Source (macro)
defstruct(attrs :: [atom()] | keyword()) :: any()

Behaves like defstruct/1, but doesn't allow to use attributes named :id or :metadata (reserved). The attribute :id is automatically defined with default nil. The attribute :metadata is automatically defined with default %Rill.Messaging.Message.Metadata{}

Link to this function

follow(preceding_message, subsequent_message) View Source
follow(preceding_message :: struct(), subsequent_message :: struct()) ::
  struct()
follow(struct_name :: module(), preceding_message :: struct()) :: struct()

Link to this function

follow(struct_name, preceding_message, subsequent_message) View Source
follow(
  struct_name :: module(),
  preceding_message :: struct(),
  subsequent_message :: module()
) :: struct()
follow(
  struct_name :: module(),
  preceding_message :: struct(),
  subsequent_message :: struct()
) :: struct()

Link to this function

follows?(map1, map2) View Source
follows?(
  %{
    metadata: %Rill.Messaging.Message.Metadata{
      causation_message_global_position: term(),
      causation_message_position: term(),
      causation_message_stream_name: term(),
      correlation_stream_name: term(),
      global_position: term(),
      position: term(),
      reply_stream_name: term(),
      schema_version: term(),
      stream_name: term(),
      time: term()
    }
  },
  %{
    metadata: %Rill.Messaging.Message.Metadata{
      causation_message_global_position: term(),
      causation_message_position: term(),
      causation_message_stream_name: term(),
      correlation_stream_name: term(),
      global_position: term(),
      position: term(),
      reply_stream_name: term(),
      schema_version: term(),
      stream_name: term(),
      time: term()
    }
  }
) :: boolean()

Link to this function

message_name(msg) View Source
message_name(msg :: message_or_type()) :: String.t()

Link to this function

message_type(msg) View Source
message_type(msg :: message_or_type()) :: [atom()]

Link to this function

message_type?(msg, type) View Source
message_type?(msg :: message_or_type(), type :: String.t()) :: boolean()

Link to this function

struct_name(msg) View Source
struct_name(msg :: message_or_type()) :: String.t()

Link to this function

to_map(msg) View Source
to_map(msg :: struct()) :: map()

Link to this function

transient_attributes() View Source
transient_attributes() :: [atom()]