ackdroppedflow

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = ackdroppedflowapi.Hostname
	Version  = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate

type Intermediate struct {
	*connector.Connector
	ToDo
}

Intermediate extends and customizes the generic base connector.

func NewIntermediate

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) AckDropped

func (svc *Mock) AckDropped(ctx context.Context) (graph *workflow.Graph, err error)

AckDropped returns the workflow graph, or a mocked graph if MockAckDropped was called.

func (*Mock) Echo

func (svc *Mock) Echo(ctx context.Context) (graph *workflow.Graph, err error)

Echo returns the workflow graph, or a mocked graph if MockEcho was called.

func (*Mock) MockAckDropped

func (svc *Mock) MockAckDropped(handler func(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)) *Mock

MockAckDropped sets up a mock handler for the AckDropped workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.

func (*Mock) MockEcho

func (svc *Mock) MockEcho(handler func(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)) *Mock

MockEcho sets up a mock handler for the Echo workflow. The handler receives typed inputs from the workflow's state and returns typed outputs. A nil handler clears the mock.

func (*Mock) MockPark

func (svc *Mock) MockPark(handler func(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)) *Mock

MockPark sets up a mock handler for Park.

func (*Mock) MockPing

func (svc *Mock) MockPing(handler func(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)) *Mock

MockPing sets up a mock handler for Ping.

func (*Mock) OnShutdown

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

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup

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

OnStartup is called when the microservice is started up.

func (*Mock) Park

func (svc *Mock) Park(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)

Park executes the mock handler.

func (*Mock) Ping

func (svc *Mock) Ping(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)

Ping executes the mock handler.

type Service

type Service struct {
	*Intermediate // IMPORTANT: Do not remove
	// contains filtered or unexported fields
}

Service implements ackdroppedflow.verify, exercising the foreman's per-task 404 ack-timeout breaker. Park's subscription is deactivated by the test before any flows are created, so dispatch to it ack-times-out and trips the breaker. Ping's subscription stays on-bus, exercising the "unrelated tasks keep dispatching" property.

func NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) AckDropped

func (svc *Service) AckDropped(ctx context.Context) (graph *workflow.Graph, err error)

AckDropped defines the single-task graph (park -> END).

func (*Service) Echo

func (svc *Service) Echo(ctx context.Context) (graph *workflow.Graph, err error)

Echo defines the single-task graph (ping -> END) used as the unrelated-task control.

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) 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.

func (*Service) Park

func (svc *Service) Park(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)

Park returns true. Subscription is deactivated by the test to provoke ack-timeouts.

func (*Service) ParkHits

func (svc *Service) ParkHits() int64

ParkHits returns the number of times Park's handler actually ran (i.e. dispatches that did NOT ack-timeout). Always zero while Park's subscription is deactivated.

func (*Service) Ping

func (svc *Service) Ping(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)

Ping returns true. Always reachable; the unrelated-task control.

func (*Service) PingHits

func (svc *Service) PingHits() int64

PingHits returns the number of times Ping's handler actually ran.

type ToDo

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	Park(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error) // MARKER: Park
	Ping(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error) // MARKER: Ping
	AckDropped(ctx context.Context) (graph *workflow.Graph, err error)                  // MARKER: AckDropped
	Echo(ctx context.Context) (graph *workflow.Graph, err error)                        // MARKER: Echo
}

ToDo is implemented by the service or mock.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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