mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
wrap payload for all processors
This commit is contained in:
@@ -16,20 +16,26 @@ type RouterInput struct {
|
||||
logger *slog.Logger
|
||||
}
|
||||
|
||||
func (ro *RouterInput) Process(ctx context.Context, payload any) (any, error) {
|
||||
func (ro *RouterInput) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
|
||||
|
||||
payload := wrappedPayload.Payload
|
||||
router, ok := ctx.Value(common.RouterContextKey).(common.RouteIO)
|
||||
if !ok {
|
||||
return nil, errors.New("router.input no router found")
|
||||
|
||||
wrappedPayload.End = true
|
||||
return wrappedPayload, errors.New("router.input no router found")
|
||||
}
|
||||
|
||||
_, err := router.HandleInput(ctx, ro.SourceId, payload)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.New("router.input failed to send input")
|
||||
wrappedPayload.End = true
|
||||
return wrappedPayload, errors.New("router.input failed to send input")
|
||||
}
|
||||
|
||||
return payload, nil
|
||||
wrappedPayload.Payload = payload
|
||||
|
||||
return wrappedPayload, nil
|
||||
}
|
||||
|
||||
func (ro *RouterInput) Type() string {
|
||||
|
||||
Reference in New Issue
Block a user