mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
switch router output to be a processor instead of specific output per route
This commit is contained in:
@@ -17,23 +17,9 @@ type RouteError struct {
|
||||
Config config.RouteConfig
|
||||
Error error
|
||||
}
|
||||
|
||||
type RouteIOError struct {
|
||||
Index int
|
||||
OutputError error
|
||||
ProcessError error
|
||||
InputError error
|
||||
}
|
||||
|
||||
type RouteIO interface {
|
||||
HandleInput(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)
|
||||
HandleOutput(ctx context.Context, destinationId string, payload any) error
|
||||
}
|
||||
|
||||
type Route struct {
|
||||
input string
|
||||
processors []processor.Processor
|
||||
output string
|
||||
}
|
||||
|
||||
func NewRoute(config config.RouteConfig) (*Route, error) {
|
||||
@@ -54,17 +40,13 @@ func NewRoute(config config.RouteConfig) (*Route, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return &Route{input: config.Input, processors: processors, output: config.Output}, nil
|
||||
return &Route{input: config.Input, processors: processors}, nil
|
||||
}
|
||||
|
||||
func (r *Route) Input() string {
|
||||
return r.input
|
||||
}
|
||||
|
||||
func (r *Route) Output() string {
|
||||
return r.output
|
||||
}
|
||||
|
||||
func (r *Route) ProcessPayload(ctx context.Context, payload any) (any, error) {
|
||||
tracer := otel.Tracer("route")
|
||||
processCtx, processSpan := tracer.Start(ctx, "ProcessPayload")
|
||||
|
||||
Reference in New Issue
Block a user