File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
main/java/com/rabbitmq/stream/impl
test/java/com/rabbitmq/stream/impl Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ public class Client implements AutoCloseable {
117
117
public static final int DEFAULT_PORT = 5552 ;
118
118
public static final int DEFAULT_TLS_PORT = 5551 ;
119
119
static final int MAX_REFERENCE_SIZE = 256 ;
120
+ static final int DEFAULT_MAX_FRAME_SIZE = 1048576 ;
120
121
static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_WRITE_CALLBACK =
121
122
new OutboundMessageWriteCallback ();
122
123
static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_BATCH_WRITE_CALLBACK =
@@ -2363,7 +2364,7 @@ public static class ClientParameters {
2363
2364
CompressionCodecFactory compressionCodecFactory ;
2364
2365
private String virtualHost = "/" ;
2365
2366
private Duration requestedHeartbeat = Duration .ofSeconds (60 );
2366
- private int requestedMaxFrameSize = 1048576 ;
2367
+ private int requestedMaxFrameSize = DEFAULT_MAX_FRAME_SIZE ;
2367
2368
private PublishConfirmListener publishConfirmListener = NO_OP_PUBLISH_CONFIRM_LISTENER ;
2368
2369
private PublishErrorListener publishErrorListener = NO_OP_PUBLISH_ERROR_LISTENER ;
2369
2370
private ChunkListener chunkListener =
Original file line number Diff line number Diff line change @@ -666,4 +666,16 @@ void creationShouldFailWithDetailsWhenUnknownHost() {
666
666
.isInstanceOfAny (ConnectTimeoutException .class , UnknownHostException .class );
667
667
}
668
668
}
669
+
670
+ @ Test
671
+ void messageLargerThanMaxFrameSizeShouldThrowException () {
672
+ int messageSize = Client .DEFAULT_MAX_FRAME_SIZE + 1 ;
673
+ Producer producer = environment .producerBuilder ().stream (stream ).build ();
674
+ assertThatThrownBy (
675
+ () ->
676
+ producer .send (
677
+ producer .messageBuilder ().addData (new byte [messageSize ]).build (),
678
+ confirmationStatus -> {}))
679
+ .isInstanceOf (IllegalArgumentException .class );
680
+ }
669
681
}
You can’t perform that action at this time.
0 commit comments