MessageStore.Message.follow

You're seeing just the function follow, go back to MessageStore.Message module for more information.
Link to this function

follow(type, recorded_message, copy_list)

View Source

Specs

follow(message_type(), recorded_message(), [path() | key()]) :: event_message()

Constructing a message from a preceding message.

Following a message has almost identical behavior to a message copy/3 method. The follow message leverages the implementation of copy/3 to fulfill its purpose.

Message Workflows

Messages frequently represent subsequent steps or stages in a process. Subsequent messages follow after preceding messages. Selected data or metadata from the preceding message is copied to the subsequent messages.

Examples

iex> recorded_message = %EventStore.RecordedEvent{
...> causation_id: nil,
...> correlation_id: "abcd1234",
...> created_at: ~U[2021-07-15 12:15:07.379908Z],
...> data: %{foo: "bazinga"},
...> event_id: "b9fcdccd-a495-4df3-889a-4b38f35a2618",
...> event_number: 935,
...> event_type: "Test",
...> metadata: %{bar: "baz", moo: 1},
...> stream_uuid: "test-123",
...> stream_version: 935
...> }
iex> Message.follow("Foo", recorded_message, [:data, [:metadata, :bar]])
%EventStore.EventData{
  event_id: nil,
  event_type: "Foo",
  data: %{foo: "bazinga"},
  metadata: %{bar: "baz"},
  causation_id: "b9fcdccd-a495-4df3-889a-4b38f35a2618",
  correlation_id: "abcd1234"
}