Documentation
¶
Overview ¶
Package pubsub provides an in-memory mock implementation of GCP Pub/Sub.
Index ¶
- type FunctionTrigger
- type Mock
- func (m *Mock) ChangeVisibility(_ context.Context, queueURL, receiptHandle string, timeout int) error
- func (m *Mock) CreateQueue(_ context.Context, cfg driver.QueueConfig) (*driver.QueueInfo, error)
- func (m *Mock) DeleteMessage(_ context.Context, queueURL, receiptHandle string) error
- func (m *Mock) DeleteQueue(_ context.Context, url string) error
- func (m *Mock) GetQueueInfo(_ context.Context, url string) (*driver.QueueInfo, error)
- func (m *Mock) ListQueues(_ context.Context, prefix string) ([]driver.QueueInfo, error)
- func (m *Mock) ReceiveMessages(_ context.Context, input driver.ReceiveMessageInput) ([]driver.Message, error)
- func (m *Mock) RemoveTrigger(queueURL string)
- func (m *Mock) SendMessage(_ context.Context, input driver.SendMessageInput) (*driver.SendMessageOutput, error)
- func (m *Mock) SetTrigger(queueURL string, fn FunctionTrigger)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FunctionTrigger ¶
FunctionTrigger is a function that gets called when a message is published to a topic.
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is an in-memory mock implementation of the GCP Pub/Sub service.
func (*Mock) ChangeVisibility ¶
func (m *Mock) ChangeVisibility(_ context.Context, queueURL, receiptHandle string, timeout int) error
ChangeVisibility modifies the ack deadline (visibility timeout) of a message in the subscription.
func (*Mock) CreateQueue ¶
CreateQueue creates a new Pub/Sub topic and subscription pair.
func (*Mock) DeleteMessage ¶
DeleteMessage acknowledges and removes a message from the subscription using its ack ID (receipt handle).
func (*Mock) DeleteQueue ¶
DeleteQueue deletes a Pub/Sub topic and subscription pair by URL.
func (*Mock) GetQueueInfo ¶
GetQueueInfo retrieves information about a Pub/Sub topic/subscription by URL.
func (*Mock) ListQueues ¶
ListQueues returns all topics whose names match the given prefix. If prefix is empty, all topics are returned.
func (*Mock) ReceiveMessages ¶
func (m *Mock) ReceiveMessages(_ context.Context, input driver.ReceiveMessageInput) ([]driver.Message, error)
ReceiveMessages pulls messages from the specified Pub/Sub subscription. Returns messages where VisibleAt <= now, and sets a new VisibleAt based on the ack deadline (visibility timeout).
func (*Mock) RemoveTrigger ¶
RemoveTrigger removes a Cloud Function trigger from a subscription.
func (*Mock) SendMessage ¶
func (m *Mock) SendMessage(_ context.Context, input driver.SendMessageInput) (*driver.SendMessageOutput, error)
SendMessage publishes a message to the specified Pub/Sub topic.
func (*Mock) SetTrigger ¶
func (m *Mock) SetTrigger(queueURL string, fn FunctionTrigger)
SetTrigger registers a Cloud Function trigger for a subscription.