Go SDKFeature Clients

Streams ClientGo SDK

Accessed via client.Streams() on the Hatchet client.

StreamsClient

StreamsClient publishes to and reads from durable topics. Unlike ctx.PutStream streams, topics are stored, independent of any run, and readers can resume from a cursor.

Methods:

NameDescription
EventsEvents streams topic's messages from the start or WithCursor.
PublishPublish returns once the message is stored.

Functions

Events

Events streams topic's messages from the start or WithCursor. The channel closes when ctx ends, the connection drops or the server hangs up; to continue, call Events again with the last event's Cursor.

func (s *StreamsClient) Events(ctx context.Context, topic string, opts ...StreamCallOpt) <-chan StreamEvent

Parameters:

NameType
ctxcontext.Context
topicstring
opts...StreamCallOpt

Returns:

Type
<-chan StreamEvent

Publish

Publish returns once the message is stored. A topic is created on first publish. A client's messages to a topic are delivered in the order they were stored.

func (s *StreamsClient) Publish(ctx context.Context, topic string, message []byte, opts ...StreamCallOpt) error

Parameters:

NameType
ctxcontext.Context
topicstring
message[]byte
opts...StreamCallOpt

Returns:

Type
error

StreamEvent

StreamEvent is a stored message. Its Cursor resumes Events right after it.

Fields:

NameTypeDescription
Payload[]byte
Cursorstring
CreatedAttime.Time

StreamCallOpt

StreamCallOpt configures a call to StreamsClient.Publish or StreamsClient.Events.

Functions

WithCursor

WithCursor resumes Events after the StreamEvent the cursor came from. Without it, Events starts at the oldest retained message. Ignored by Publish.

func WithCursor(cursor string) StreamCallOpt

Parameters:

NameType
cursorstring

Returns:

Type
StreamCallOpt
WithNamespace

WithNamespace sets the namespace; the default is "".

func WithNamespace(namespace string) StreamCallOpt

Parameters:

NameType
namespacestring

Returns:

Type
StreamCallOpt

Last updated on October 2, 2026

On this page