-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARTEMIS-5093 support configurable onMessage timeout w/closing consumer #5291
base: main
Are you sure you want to change the base?
Conversation
43f377d
to
2b6fbd1
Compare
return config.onMessageCloseTimeout; | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API docs specify the value set must be greater than zero, but there isn't any validation of that, should there be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm...That comment was left-over from a copy & paste. I went looking through the existing code to see how validation is done for other parameters, and I'm not actually seeing any. I'm continuing my investigation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did look into what it does with that configuration value and since it is passing into a CountdownLatch is seems like it will not trigger an exception but will return immediately so from the standpoint of being able to be set to zero or negative it works, although seems an absurd value to assign.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem weird to configure those if actually knowing thats what it then does, but I'd guess some might think one of those would simply mean keep waiting (e.g as is the described behaviour in the JMS spec, albeit that also originally described to effectively deadlock yourself as result hehe), especially if not reading the javadoc (should there also be actual-docs addition?).
...re-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java
Outdated
Show resolved
Hide resolved
...s/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageHandlerTest.java
Outdated
Show resolved
Hide resolved
Hey sorry, I was just wondering if there was any update on this or plans to get it into a new version? Thank you so much for starting the implementation process though! |
// don't just Thread.sleep() here because it will be interrupted on ClientConsumer.close() | ||
long start = System.currentTimeMillis(); | ||
while (System.currentTimeMillis() - start < 2000) { | ||
try { | ||
Thread.sleep(100); | ||
} catch (InterruptedException e) { | ||
// ignore | ||
} | ||
} | ||
}); | ||
latch.await(); | ||
long start = System.currentTimeMillis(); | ||
consumer.close(); | ||
long end = System.currentTimeMillis(); | ||
assertTrue( (end - start >= timeout) && (end - start <= 2000), "Closing consumer took " + (end - start) + "ms"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to use a shorter timeout for the close as Dom suggests, thus reducing the test duration, but also use a longer/indefinite 'dont complete yet' guard in the handler to be sure it is always still running after/when the timeout expires and can then 'immediately complete' on request, e.g instead arrange its waiting/exit-gating on an [atomic]boolean and other latch to wait on the rest of the test then complete quickly on request rather than the current time loop.
2b6fbd1
to
3da1cb2
Compare
There wasn't a clear place to add documentation about this so I'm relying on JavaDoc.