Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) AckDropped(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) Echo(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Mock) MockAckDropped(...) *Mock
- func (svc *Mock) MockEcho(...) *Mock
- func (svc *Mock) MockPark(...) *Mock
- func (svc *Mock) MockPing(...) *Mock
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) Park(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)
- func (svc *Mock) Ping(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)
- type Service
- func (svc *Service) AckDropped(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) Echo(ctx context.Context) (graph *workflow.Graph, err error)
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Park(ctx context.Context, flow *workflow.Flow, tag string) (parked bool, err error)
- func (svc *Service) ParkHits() int64
- func (svc *Service) Ping(ctx context.Context, flow *workflow.Flow, tag string) (pinged bool, err error)
- func (svc *Service) PingHits() int64
- type ToDo
Constants ¶
const ( Hostname = ackdroppedflowapi.Hostname Version = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
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 (*Mock) AckDropped ¶
AckDropped returns the workflow graph, or a mocked graph if MockAckDropped 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 ¶
OnShutdown is called when the microservice is shut down.
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 (*Service) AckDropped ¶
AckDropped defines the single-task graph (park -> END).
func (*Service) Echo ¶
Echo defines the single-task graph (ping -> END) used as the unrelated-task control.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
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 ¶
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.
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.