GH-2552: Fix Builder Argument Types maxLength etc

Resolves https://github.com/spring-projects/spring-amqp/issues/2552

Variables map to Erlang ints which are 8 bytes, so need to be long in Java.
This commit is contained in:
Gary Russell
2023-10-31 11:51:18 -04:00
committed by GitHub
parent 1b38f94941
commit 613c2895ab
6 changed files with 28 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ import org.springframework.util.StringUtils;
* Based on <a href="https://www.rabbitmq.com/streams.html">Streams documentation</a>
*
* @author Sergei Kurenchuk
* @author Gary Russell
* @since 3.1
*/
public class SuperStreamBuilder {
@@ -73,7 +74,7 @@ public class SuperStreamBuilder {
* @param bytes the max total size in bytes
* @return the builder
*/
public SuperStreamBuilder maxLength(int bytes) {
public SuperStreamBuilder maxLength(long bytes) {
return withArgument("max-length-bytes", bytes);
}
@@ -82,7 +83,7 @@ public class SuperStreamBuilder {
* @param bytes the max segments size in bytes
* @return the builder
*/
public SuperStreamBuilder maxSegmentSize(int bytes) {
public SuperStreamBuilder maxSegmentSize(long bytes) {
return withArgument("x-stream-max-segment-size-bytes", bytes);
}

View File

@@ -85,8 +85,8 @@ public class SuperStreamConfigurationTests {
var finalPartitionsNumber = 4;
var finalName = "test-name";
var maxAge = "1D";
var maxLength = 10_000_000;
var maxSegmentsSize = 100_000;
var maxLength = 10_000_000L;
var maxSegmentsSize = 100_000L;
var initialClusterSize = 5;
var testArgName = "test-key";