Skip to content

Commit ce842ff

Browse files
committed
#354 | abstract metrics implementation
1 parent 6e8395c commit ce842ff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/com/rabbitmq/client/impl/AbstractMetricsCollector.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ public void basicPublish(Channel channel) {
102102
}
103103
}
104104

105+
@Override
106+
public void basicPublishFailure(Channel channel) {
107+
try {
108+
markMessagePublishFailed();
109+
} catch(Exception e) {
110+
LOGGER.info("Error while computing metrics in basicPublishFailure: " + e.getMessage());
111+
}
112+
}
113+
105114
@Override
106115
public void basicConsume(Channel channel, String consumerTag, boolean autoAck) {
107116
try {
@@ -331,6 +340,11 @@ private ChannelState(Channel channel) {
331340
*/
332341
protected abstract void markPublishedMessage();
333342

343+
/**
344+
* Marks the event of a message publishing failure.
345+
*/
346+
protected abstract void markMessagePublishFailed();
347+
334348
/**
335349
* Marks the event of a consumed message.
336350
*/

0 commit comments

Comments
 (0)