Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12065

[Camel-consul] firstIndex cannot be set if it is out of Long range

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.20.1
    • Fix Version/s: 2.21.0
    • Component/s: camel-consul
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Documentation claims that firstIndex option must be of Long Java type.
      However WaitIndex (that is generated by Consul and should be set for firstIndex to skip all events until one that has such WaitIndex) is actually of BigInteger type and can be out of Long type range - https://github.com/hashicorp/consul/blob/master/api/event.go#L90-L104

      org.apache.camel.component.consul.enpoint.ConsulEventConsumer has index field of correct type AtomicReference<BigInteger> and is initialized as

      this.index = new AtomicReference(BigInteger.valueOf(configuration.getFirstIndex()));
      

      However BigInteger value that is out of Long range cannot be passed for index from apiEnpoint option firstIndex because org.apache.camel.component.consul.ConsulConfiguration has firstIndex field that is declared as long type:

          @UriParam(
              label = "consumer,watch",
              defaultValue = "0"
          )
          private long firstIndex;
      

      Seems that it should be changed to be of BigInteger type.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                acosentino Andrea Cosentino
                Reporter:
                Viachaslau.Tsikhanovich Viachaslau Tsikhanovich
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: