diff --git a/exn-connector/src/main/groovy/eu/nebulouscloud/exn/core/Consumer.groovy b/exn-connector/src/main/groovy/eu/nebulouscloud/exn/core/Consumer.groovy index 4f16ac7..1424c65 100644 --- a/exn-connector/src/main/groovy/eu/nebulouscloud/exn/core/Consumer.groovy +++ b/exn-connector/src/main/groovy/eu/nebulouscloud/exn/core/Consumer.groovy @@ -74,14 +74,22 @@ class Consumer extends Link{ Message message = delivery.message(); Map body = this.processMessage(message, context) - this.handler.onMessage( - this.key, - this.address, - body, - message, - context - ) - delivery.accept() + try { + this.handler.onMessage( + this.key, + this.address, + body, + message, + context + ) + delivery.accept() + }catch (Exception e){ + if(!delivery.state().isAccepted()){ + delivery.reject('Generic onMessage error',e.message) + } + logger.error('Generic onMessage error',e) + } + } }