Merge pull request #610 from jbonofre/AMQ-7443

[AMQ-7443] Add connection remote addr in the prefetch warn log message
This commit is contained in:
Jean-Baptiste Onofré 2021-01-14 06:05:37 +01:00 committed by GitHub
commit 4dc6903c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -116,7 +116,11 @@ public class TopicSubscription extends AbstractSubscription {
if (info.getPrefetchSize() > 1 && matched.size() > info.getPrefetchSize()) {
// Slow consumers should log and set their state as such.
if (!isSlowConsumer()) {
LOG.warn("{}: has twice its prefetch limit pending, without an ack; it appears to be slow", toString());
String remoteAddr = null;
if (context != null && context.getConnection() != null) {
remoteAddr = context.getConnection().getRemoteAddress();
}
LOG.warn("{}: has twice its prefetch limit pending, without an ack; it appears to be slow{}", toString(), (remoteAddr != null) ? ": " + remoteAddr : "");
setSlowConsumer(true);
for (Destination dest: destinations) {
dest.slowConsumer(getContext(), this);
@ -133,7 +137,7 @@ public class TopicSubscription extends AbstractSubscription {
return;
}
if (!warnedAboutWait) {
LOG.info("{}: Pending message cursor [{}] is full, temp usag ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
LOG.info("{}: Pending message cursor [{}] is full, temp usage ({}%) or memory usage ({}%) limit reached, blocking message add() pending the release of resources.",
new Object[]{
toString(),
matched,