Stargate.Message (stargate v0.2.0) View Source
Defines the Elixir Struct that represents the structure of a Pulsar message. The struct combines the "location" data of the received messages (persistent vs. non-persistent, tenant, namespace, topic) with the payload, any key and/or properties provided with the message, and the publication timestamp as an DateTime struct, and the messageId assigned by the cluster.
Example
message = %Stargate.Message{
topic: "ready-for-release",
namespace: "research",
tenant: "internal",
persistence: "persistent",
message_id: "CAAQAw==",
payload: "Hello World",
key: "1234",
properties: nil,
publish_time: ~U[2020-01-10 18:13:34.443264Z]
}
Link to this section Summary
Functions
Create a %Stargate.Message{} struct from a list of arguments. Takes the map decoded from the json message payload received from Pulsar and adds the tenant, namespace, topic, persistence information to maintain "location awareness" of a message's source topic.
Link to this section Types
Specs
Link to this section Functions
Specs
Create a %Stargate.Message{} struct from a list of arguments. Takes the map decoded from the json message payload received from Pulsar and adds the tenant, namespace, topic, persistence information to maintain "location awareness" of a message's source topic.
Creating a %Stargate.Message{} via the new/5
function automatically converts the ISO8601-formatted
publish timestamp to a DateTime struct and decodes the message payload from the Base64 encoding
received from the cluster.