KubeMQ
Client SDKsGoReference

Events Store

Durable events with replay — KubeMQ Go SDK reference.

Events Store persists messages so subscribers can replay from a chosen position (first, last, sequence, time, or delta).

SendEventStore

func (c *Client) SendEventStore(ctx context.Context, event *EventStore) (*EventStoreResult, error)

Sends a durable event and returns broker-assigned identifiers and timestamps.

Parameters:

NameTypeRequiredDescription
ctxcontext.ContextYesSend deadline
event*EventStoreYesChannel, body/metadata/tags for stored events

Returns: *EventStoreResult — message ID and send metadata.

Throws: *KubeMQError — validation or transport errors.

SubscribeToEventsStore

func (c *Client) SubscribeToEventsStore(ctx context.Context, channel, group string, startOpt SubscriptionOption, opts ...SubscribeOption) (*Subscription, error)

Subscribes with replay semantics. startOpt is a required start-position selector (StartFromNewEvents, StartFromFirstEvent, StartFromLastEvent, StartFromSequence, StartFromTime, or StartFromTimeDelta); opts are optional subscription behavior options.

Parameters:

NameTypeRequiredDescription
ctxcontext.ContextYesSubscription lifetime
channelstringYesEvents Store channel
groupstringNoConsumer group
startOptSubscriptionOptionYesReplay start position (e.g. StartFromNewEvents())
opts...SubscribeOptionNoBuffers, callbacks, error handler

Returns: *Subscription — unsubscribe handle.

Replay start positions

StartBehavior
Start from firstReplay from oldest retained message
Start from lastBegin after the latest message at subscribe time
Start new onlyOnly messages published after subscribe
Start at sequenceFrom a specific sequence number
Start at time / deltaWall-clock or relative offsets

Note: startOpt constructors (StartFromNewEvents, StartFromSequence, etc.) are defined in event_store.go; opts use SubscribeOption helpers (WithOnEventStoreReceive, WithOnError, etc.). Align replay fields with server retention policies.

Quick Usage

events_store.go
es := kubemq.NewEventStore()
es.SetChannel("store.a")
es.SetBody([]byte("audit"))

res, err := client.SendEventStore(ctx, es)
if err != nil {
    return err
}
_ = res.Id

See Also

Was this page helpful?

On this page