JohT/showcase-quarkus-eventsourcing

ArithmeticException while streamed nickname query

JohT opened this issue · 1 comments

JohT commented

Problem
NicknameEventStreamResource leads to an
java.lang.ArithmeticException: long overflow at java.lang.Math.multiplyExact(Math.java:892) at java.time.Instant.toEpochMilli(Instant.java:1232)

Details
FetchDistinctNicknamesQuery uses Instant.MIN internally to express a query of all past nickname changes. This is then converted to the sequence number using "toEpochMilli". Since Instant.MIN.toEpochMilli() leads to an java.lang.ArithmeticException, another way needs to be found to express a query from time=zero on.

Proposed Solution
Using Instant.ofEpochMilli(0) to express a query of all past nickname changes might solve this problem.

JohT commented

Solved