Documentation ¶
Index ¶
- Variables
- func NewMemoryPublisher(name string, options ...PublisherOptions) (*Publisher, *Subscriber)
- func ParseQueryResults(query *dynamodb.QueryOutput) ([]string, error)
- func Query(publisherName string) *dynamodb.QueryInput
- func Read(ctx context.Context, publisherName string) ([]string, error)
- func SetupEventBridgeReceiverInfrastructure(cfg aws.Config, p *Publisher) error
- type EventBridgeClient
- type EventBridgeReceiver
- type EventBridgeTransport
- type EventBridgeTransportOptions
- type InMemoryReceiver
- type InMemoryTransport
- type Message
- type MessageStore
- type NetworkTransport
- type Publisher
- type PublisherOptions
- type Reader
- type Receiver
- type Subscriber
- type Transform
- type Transport
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewMemoryPublisher ¶
func NewMemoryPublisher(name string, options ...PublisherOptions) (*Publisher, *Subscriber)
NewMemoryPublisher creates a new Publisher with the given name and options. By default, the Publisher uses an in-memory Transport.
func ParseQueryResults ¶
func ParseQueryResults(query *dynamodb.QueryOutput) ([]string, error)
func Query ¶
func Query(publisherName string) *dynamodb.QueryInput
Types ¶
type EventBridgeClient ¶
type EventBridgeClient interface {
PutEvents(ctx context.Context, events *eventbridge.PutEventsInput, opts ...func(*eventbridge.Options)) (*eventbridge.PutEventsOutput, error)
}
EventBridgeTransport is a Transport that ships messages via AWS EventBridge
type EventBridgeReceiver ¶
type EventBridgeReceiver struct {
// contains filtered or unexported fields
}
EventBridgeReceiver
type EventBridgeTransport ¶
type EventBridgeTransport struct { EventBridge EventBridgeClient // contains filtered or unexported fields }
EventBridgeTransport is a Transport that ships messages via AWS EventBridge
func (*EventBridgeTransport) Publish ¶
func (t *EventBridgeTransport) Publish(message Message) error
Publish sends a message to the specified AWS EventBus via the EventBridgeTransport Note that the message is transformed before being sent and the default transform is to simply marshal the message to JSON. This can be overridden by providing a custom transform function via the WithTransform functional option. Note that it is assumed that the corresponding Rule in AWS EventBridge is configured to match this event and route it to the appropriate target. Successfully delivery of the event to the EventBus is no indication that the event will be routed to the target.
type EventBridgeTransportOptions ¶
type EventBridgeTransportOptions func(*EventBridgeTransport)
EventBridgeTransportOptions are functional options for configuring an EventBridgeTransport Such options include setting the DetailType, Source, EventBusName, and any custom Transform function needed (if any) to modify the message before sending it
func WithDetailType ¶
func WithDetailType(detailType string) EventBridgeTransportOptions
WithDetailType is a functional option specifying the DetailType of the EventBridgeTransport
func WithEventBusName ¶
func WithEventBusName(eventBusName string) EventBridgeTransportOptions
WithEventBusName is a functional option specifying the EventBusName of the EventBridgeTransport
func WithSource ¶
func WithSource(source string) EventBridgeTransportOptions
WithSource is a functional option specifying the Source of the EventBridgeTransport
func WithTransform ¶
func WithTransform(transform Transform) EventBridgeTransportOptions
WithTransform is a functional option specifying the Transform function of the EventBridgeTransport It's the users responsibility to ensure that any errors are handled correctly
type InMemoryReceiver ¶
type InMemoryReceiver struct {
// contains filtered or unexported fields
}
InMemoryReceiver is a Receiver that receives messages from an InMemoryTransport
func (*InMemoryReceiver) Receive ¶
func (r *InMemoryReceiver) Receive(ctx context.Context) ([]Message, error)
Receive blocks until a message is available or the context is done. It then returns all messages received up to that point. Ideally signal the context when you're done receiving messages, rather than closing the channel.
type InMemoryTransport ¶
type InMemoryTransport struct {
// contains filtered or unexported fields
}
InMemoryTransport is a Transport that deals with messages within process
func NewMemoryTransport ¶
func NewMemoryTransport() *InMemoryTransport
InMemoryReceiver is a Receiver that receives messages from an InMemoryTransport This is primarily useful in testing both this package and any dependent package
func (*InMemoryTransport) GetReceiver ¶
func (t *InMemoryTransport) GetReceiver() *InMemoryReceiver
GetReceiver returns a Receiver that can be used to receive messages from the InMemoryTransport It's convenient to be able to get the associated Receiver from the Transport
func (*InMemoryTransport) Publish ¶
func (t *InMemoryTransport) Publish(m Message) error
Publish sends a message to the InMemoryTransport by sending a message on the channel
type Message ¶
Message is a unit of data that can be published by a Publisher. Message contains the name of the Publisher that published it, the order in which it was published, and the content of the message.
type MessageStore ¶
type MessageStore interface {
All() []Message
}
type NetworkTransport ¶
type NetworkTransport struct {
// contains filtered or unexported fields
}
NetworkTransport is a Transport that ships messages over the Network
func (*NetworkTransport) Publish ¶
func (t *NetworkTransport) Publish(m Message) error
Publish sends a message to the NetworkTransport by sending an HTTP POST Request
type Publisher ¶
type Publisher struct { Transport Transport // contains filtered or unexported fields }
Publishers are producers of messages. They deliver a Message to a Receiver via a Transport.
func NewEventBridgePublisher ¶
func NewEventBridgePublisher(name string, eventBridge EventBridgeClient, opts ...EventBridgeTransportOptions) *Publisher
type PublisherOptions ¶
type PublisherOptions func(*Publisher)
PublisherOptions are functional options for configuring a Publisher. Pass them to NewMemoryPublisher at construction time.
func WithEventBridgeTransport ¶
func WithEventBridgeTransport(eventBridge EventBridgeClient, opts ...EventBridgeTransportOptions) PublisherOptions
WithEventBridgeTransport is a functional option specifying that a Publisher should use an EventBridgeTransport to deliver messages
func WithNetworkTransport ¶
func WithNetworkTransport(endpoint string) PublisherOptions
WithNetworkTransport is a functional option specifying that a Publisher should use the given endpoint to deliver messages over the network
func WithTransport ¶
func WithTransport(t Transport) PublisherOptions
WithTransport is a functional option specifying that a Publisher should use the given Transport to deliver messages.
type Reader ¶
type Reader struct { PublisherName string CurrentMessage int Store MessageStore }
func (*Reader) NewMessages ¶
type Subscriber ¶
Subscriber is a consumer of messages. It expects to receive messages from its Receiver and save them to its [Store].
func NewEventBridgeSubscriber ¶
func NewEventBridgeSubscriber(event events.EventBridgeEvent, store store.Store) *Subscriber
type Transform ¶
Transform is a way to modify a message before sending it to EventBridgeClient It can be considered a way to add a pre-processing step to the message Useful in the case that you have specific requirements you need to adhere to in order for downstream AWS EventBridge Rules to target your event correctly