Skip to content

Commit 61ca34b

Browse files
authored
Merge pull request #1 from muhadif/adjuast-ack-message
adjustment : handling Nack and Ack in different ways to support returning error will retry the handler
2 parents f142ac9 + 7de034d commit 61ca34b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

router.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ func (r *Router) HandleMessage(m *Message) error {
3030
path := m.Payload.Attributes[client.MessageAttributeNameRoute]
3131
h, okRoute := r.handlers[path]
3232
if okRoute {
33+
err := h.HandleMessage(m)
34+
if err != nil {
35+
m.Payload.Nack()
36+
return err
37+
}
3338
m.Payload.Ack()
34-
return h.HandleMessage(m)
3539
}
3640
// if you need reporting please contrib this error handling
3741
// return errors.New("Route Not Any Match")

0 commit comments

Comments
 (0)