messaging

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = messagingapi.Hostname
	Version  = 229
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate added in v1.22.0

type Intermediate struct {
	*connector.Connector
	ToDo
}

Intermediate extends and customizes the generic base connector.

func NewIntermediate added in v1.22.0

func NewIntermediate(impl ToDo) *Intermediate

NewIntermediate creates a new instance of the intermediate.

type Mock

type Mock struct {
	*Intermediate
	// contains filtered or unexported fields
}

Mock is a mockable version of the microservice, allowing functions, event sinks and web handlers to be mocked.

func NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) CacheLoad added in v1.22.0

func (svc *Mock) CacheLoad(w http.ResponseWriter, r *http.Request) (err error)

CacheLoad executes the mock handler.

func (*Mock) CacheStore added in v1.22.0

func (svc *Mock) CacheStore(w http.ResponseWriter, r *http.Request) (err error)

CacheStore executes the mock handler.

func (*Mock) DefaultQueue added in v1.22.0

func (svc *Mock) DefaultQueue(w http.ResponseWriter, r *http.Request) (err error)

DefaultQueue executes the mock handler.

func (*Mock) Home added in v1.22.0

func (svc *Mock) Home(w http.ResponseWriter, r *http.Request) (err error)

Home executes the mock handler.

func (*Mock) MockCacheLoad added in v1.22.0

func (svc *Mock) MockCacheLoad(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockCacheLoad sets up a mock handler for CacheLoad.

func (*Mock) MockCacheStore added in v1.22.0

func (svc *Mock) MockCacheStore(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockCacheStore sets up a mock handler for CacheStore.

func (*Mock) MockDefaultQueue added in v1.22.0

func (svc *Mock) MockDefaultQueue(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockDefaultQueue sets up a mock handler for DefaultQueue.

func (*Mock) MockHome added in v1.22.0

func (svc *Mock) MockHome(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockHome sets up a mock handler for Home.

func (*Mock) MockNoQueue added in v1.22.0

func (svc *Mock) MockNoQueue(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockNoQueue sets up a mock handler for NoQueue.

func (*Mock) NoQueue added in v1.22.0

func (svc *Mock) NoQueue(w http.ResponseWriter, r *http.Request) (err error)

NoQueue executes the mock handler.

func (*Mock) OnShutdown added in v1.22.0

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup added in v1.22.0

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

type Service

type Service struct {
	*Intermediate // IMPORTANT: Do not remove
}

Service implements the messaging.example microservice.

The Messaging microservice demonstrates service-to-service communication patterns.

func NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) CacheLoad

func (svc *Service) CacheLoad(w http.ResponseWriter, r *http.Request) (err error)

CacheLoad looks up an element in the distributed cache of the microservice.

func (*Service) CacheStore

func (svc *Service) CacheStore(w http.ResponseWriter, r *http.Request) (err error)

CacheStore stores an element in the distributed cache of the microservice.

func (*Service) DefaultQueue

func (svc *Service) DefaultQueue(w http.ResponseWriter, r *http.Request) (err error)

DefaultQueue demonstrates how the DefaultQueue subscription option is used to create a unicast request/response communication pattern. Only one of the instances of this microservice will respond to each request.

func (*Service) Home

func (svc *Service) Home(w http.ResponseWriter, r *http.Request) (err error)

Home demonstrates making requests using multicast and unicast request/response patterns.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) NoQueue

func (svc *Service) NoQueue(w http.ResponseWriter, r *http.Request) (err error)

NoQueue demonstrates how the NoQueue subscription option is used to create a multicast request/response communication pattern. All instances of this microservice will respond to each request.

func (*Service) OnShutdown

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

type ToDo added in v1.22.0

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	Home(w http.ResponseWriter, r *http.Request) (err error)         // MARKER: Home
	NoQueue(w http.ResponseWriter, r *http.Request) (err error)      // MARKER: NoQueue
	DefaultQueue(w http.ResponseWriter, r *http.Request) (err error) // MARKER: DefaultQueue
	CacheLoad(w http.ResponseWriter, r *http.Request) (err error)    // MARKER: CacheLoad
	CacheStore(w http.ResponseWriter, r *http.Request) (err error)   // MARKER: CacheStore
}

ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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