Documentation
¶
Index ¶
- type Broker
- func (b *Broker) Acks(t *testing.T, ctx context.Context, n int) map[string]string
- func (b *Broker) Cleanup(t *testing.T)
- func (b *Broker) DaprdOptions(t *testing.T, componentName string, opts ...daprd.Option) []daprd.Option
- func (b *Broker) DropStream()
- func (b *Broker) IsPaused() bool
- func (b *Broker) NextPublishedCloudEvent(t *testing.T, ctx context.Context) (string, string)
- func (b *Broker) PauseCalled() int64
- func (b *Broker) PauseStarted() <-chan struct{}
- func (b *Broker) PubSub() *pubsub.PubSub
- func (b *Broker) PublishCloudEvents(t *testing.T, ctx context.Context, topic string, ids ...string)
- func (b *Broker) PublishHelloWorld(topic string) <-chan *compv1.PullMessagesRequest
- func (b *Broker) Run(t *testing.T, ctx context.Context)
- func (b *Broker) Socket() *socket.Socket
- type Option
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 (*Broker) Acks ¶ added in v1.19.0
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) DaprdOptions ¶
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
IsPaused reports whether the pluggable server is currently in the paused state.
func (*Broker) NextPublishedCloudEvent ¶ added in v1.19.0
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
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) PublishCloudEvents ¶ added in v1.19.0
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
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.