Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/storm/pull/2639#discussion_r183233537
--- Diff:
external/storm-jms/src/main/java/org/apache/storm/jms/spout/JmsSpout.java ---
@@ -339,26 +339,26 @@ public void nextTuple() {
*/
@Override
public void ack(Object msgId) {
-
Message msg = this.pendingMessages.remove(msgId);
- JmsMessageID oldest = this.toCommit.first();
- if (msgId.equals(oldest)) {
- if (msg != null) {
- try {
- LOG.debug("Committing...");
- msg.acknowledge();
- LOG.debug("JMS Message acked: " + msgId);
- this.toCommit.remove(msgId);
- } catch (JMSException e) {
- LOG.warn("Error acknowldging JMS message: " + msgId,
e);
+ if (!toCommit.isEmpty()) {
+ JmsMessageID oldest = this.toCommit.first();
+ if (msgId.equals(oldest)) {
+ if (msg != null) {
+ try {
+ LOG.debug("Committing...");
+ msg.acknowledge();
--- End diff --
I'm sorry I'm not familiar with JMS, but could you explain how this
approach guarantee ack are done for all messages? Looks like it just removes
the message from `toCommit` if late ack messages come earlier.
---