support error handler in memory broker (#1947)

This commit is contained in:
Asim Aslam 2020-08-19 10:20:43 +01:00 committed by GitHub
parent 5d6b7b3d7d
commit 7eaec450a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,9 @@ func (m *memoryBroker) Publish(topic string, msg *broker.Message, opts ...broker
for _, sub := range subs {
if err := sub.handler(msg); err != nil {
if eh := sub.opts.ErrorHandler; eh != nil {
eh(msg, err)
}
continue
}
}