Help us shape the future of Go! Take the 2026 Go Developer Survey

broker

package
v1.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, opts ...Option) *Broker

func (*Broker) Acks added in v1.19.0

func (b *Broker) Acks(t *testing.T, ctx context.Context, n int) map[string]string

Acks waits for daprd to ack n messages, and returns the error message each was acked with, empty for a successful ack, keyed by message ID.

func (*Broker) Cleanup

func (b *Broker) Cleanup(t *testing.T)

func (*Broker) DaprdOptions

func (b *Broker) DaprdOptions(t *testing.T, componentName string, opts ...daprd.Option) []daprd.Option

func (*Broker) DropStream added in v1.18.5

func (b *Broker) DropStream()

DropStream ends the in-flight PullMessages stream, cancelling the context the component gave the runtime's inbound handler. Stands in for a Kafka consumer group rebalance.

func (*Broker) IsPaused added in v1.17.7

func (b *Broker) IsPaused() bool

IsPaused reports whether the pluggable server is currently in the paused state.

func (*Broker) NextPublishedCloudEvent added in v1.19.0

func (b *Broker) NextPublishedCloudEvent(t *testing.T, ctx context.Context) (string, string)

NextPublishedCloudEvent waits for daprd to publish a cloud event to the broker, such as to a dead letter topic, and returns its topic and ID. The broker must have been created WithRecordPublishes.

func (*Broker) PauseCalled added in v1.17.7

func (b *Broker) PauseCalled() int64

PauseCalled reports how many times the runtime invoked Pause on the pluggable server. Used by tests asserting the pause-and-drain shutdown path was exercised.

func (*Broker) PauseStarted added in v1.17.7

func (b *Broker) PauseStarted() <-chan struct{}

PauseStarted returns a channel that is closed the first time Pause is called. Tests use this to wait for the runtime's shutdown path to invoke Pause without polling.

func (*Broker) PubSub

func (b *Broker) PubSub() *pubsub.PubSub

func (*Broker) PublishCloudEvents added in v1.19.0

func (b *Broker) PublishCloudEvents(t *testing.T, ctx context.Context, topic string, ids ...string)

PublishCloudEvents delivers one cloud event per ID to daprd on topic, in order. The pluggable component dispatches messages to daprd concurrently, so they are spaced out to keep this order in a bulk subscriber's batch.

func (*Broker) PublishHelloWorld

func (b *Broker) PublishHelloWorld(topic string) <-chan *compv1.PullMessagesRequest

func (*Broker) Run

func (b *Broker) Run(t *testing.T, ctx context.Context)

func (*Broker) Socket

func (b *Broker) Socket() *socket.Socket

type Option added in v1.17.7

type Option func(*brokerOptions)

Option configures broker creation.

func WithPausable added in v1.17.7

func WithPausable() Option

WithPausable opts the pluggable server in to the Pause/Resume RPCs. Default is non-pausable (returns codes.Unimplemented), matching the majority of pubsub components.

func WithRecordPublishes added in v1.19.0

func WithRecordPublishes() Option

WithRecordPublishes records the messages daprd publishes to the broker, such as to a dead letter topic, for NextPublish to return, instead of handing them to the in-memory pubsub.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL