From f04a7183ea0a8dd1d54cba924da7e5debae425e5 Mon Sep 17 00:00:00 2001 From: James Harris Date: Thu, 26 Sep 2024 10:45:55 +1000 Subject: [PATCH] Simplify kind switch. --- handler.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/handler.go b/handler.go index 18eb5ad..06a3bb3 100644 --- a/handler.go +++ b/handler.go @@ -173,23 +173,8 @@ func mustHaveProducerRoute( } } - verb := "" - routeFunc := "" - - message.SwitchKind( - kind, - func() { - verb = "execute" - routeFunc = "ExecutesCommand" - }, - func() { - verb = "record" - routeFunc = "RecordsEvent" - }, - func() { - panic("no handlers mandate use of timeout messages") - }, - ) + verb := message.MapKind(kind, "execute", "record", "schedule") + routeFunc := message.MapKind(kind, "ExecutesCommand", "RecordsEvent", "SchedulesTimeout") validation.Panicf( `%s is not configured to %s any %ss, at least one %s() route must be added within Configure()`,