Add acceptance handling and fix reconnect issue of consumer

Change-Id: If5bcf1fd88d1b1e0ec4af4a7af5d091df5345a6f
This commit is contained in:
gsavvas 2024-05-24 15:25:17 +03:00
parent 42103992a4
commit 2beb2452f2

View File

@ -74,14 +74,22 @@ class Consumer extends Link<Receiver>{
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)
}
}
}