Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-98

Example examples/features/ha/colocated-failover-scale-down is not acknowledging all received messages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • A-MQ 7.0.0.ER8
    • None
    • Interactive Demo/Tutorial

      This example is working, but

      /examples/features/ha/colocated-failover-scale-down/.../ColocatedFailoverScaleDownExample.java
               // Step 10. Receive and acknowledge all of the sent messages, notice that they will be out of order, this is
               // because they were initially round robined to both nodes then when the server failed were reloaded into the
               // live server.
               TextMessage message0 = null;
               for (int i = 0; i < numMessages * 2; i++) {
                  message0 = (TextMessage) consumer.receive(5000);
                  if (message0 == null) {
                     throw new IllegalStateException("Message not received!");
                  }
                  System.out.println("Got message: " + message0.getText());
               }
               message0.acknowledge();
      

      I think that the message0.acknowledge(); line should be inside the for cycle, so that every received message gets acknowledged and not just the last one.

              rh-ee-ataylor Andy Taylor
              jdanek@redhat.com Jiri Daněk
              Jiri Daněk Jiri Daněk
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: