Documentation
¶
Index ¶
Constants ¶
View Source
const IDHeaderKey = "_clinia_message_id"
Variables ¶
This section is empty.
Functions ¶
func WithID ¶
func WithID(id string) newMessageOption
WithID sets the ID of the message. A ksuid will be generated if no ID is provided.
func WithMetadata ¶
func WithMetadata(m MessageMetadata) newMessageOption
WithMetadata sets the metadata of the message.
Types ¶
type ConsumerGroup ¶
type ConsumerGroup string
func (ConsumerGroup) ConsumerGroup ¶
func (group ConsumerGroup) ConsumerGroup(scope string) string
ConsumerGroup returns the consumer group name with the given scope. If the scope is empty, it returns the consumer group name as is. This should be used when interacting with the concrete pubsubs (e.g. Kafka).
type Message ¶
type Message struct {
ID string
Metadata MessageMetadata
Payload []byte
}
Message intentionally has no json marshalling fields as we want to pass by our own kgox.DefaultMarshaler
func NewMessage ¶
NewMessage creates a new Message with the given payload and options.
Parameters:
- payload: The payload of the message as a byte slice.
- opts: Optional parameters to customize the creation of the message. By default, a new UUID is generated for the message.
Returns:
- *Message: A pointer to the created Message.
type MessageMetadata ¶
Click to show internal directories.
Click to hide internal directories.