googlecloud_http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const UUIDHeaderKey = "_watermill_message_uuid"

Variables

This section is empty.

Functions

func DefaultUnmarshalMessageFunc

func DefaultUnmarshalMessageFunc(r *http.Request) (*message.Message, error)

Types

type RegisterHttpHandler

type RegisterHttpHandler func(pattern string, handler http.Handler)

Register the route `pattern` that matches http method to execute the `handler`.

type Subscriber

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

func NewSubscriber

func NewSubscriber(
	config SubscriberConfig,
	logger watermill.LoggerAdapter,
) (*Subscriber, error)

func (*Subscriber) Close

func (s *Subscriber) Close() error

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(ctx context.Context, url string) (<-chan *message.Message, error)

Subscribe creates a HTTP handler which will listen on provided url for messages. The callee must register this HTTP handler on it's mux of choice before calling `StartHTTPServer` or equivalent.

When request is sent, it will wait for the `Ack`. When Ack is received 200 HTTP status will be sent. When Nack is sent, 500 HTTP status will be sent.

type SubscriberConfig

type SubscriberConfig struct {
	RegisterHttpHandler  RegisterHttpHandler
	UnmarshalMessageFunc UnmarshalMessageFunc
}

type UnmarshalMessageFunc

type UnmarshalMessageFunc func(request *http.Request) (*message.Message, error)

Jump to

Keyboard shortcuts

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