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 {
117117 public static final int DEFAULT_PORT = 5552 ;
118118 public static final int DEFAULT_TLS_PORT = 5551 ;
119119 static final int MAX_REFERENCE_SIZE = 256 ;
120+ static final int DEFAULT_MAX_FRAME_SIZE = 1048576 ;
120121 static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_WRITE_CALLBACK =
121122 new OutboundMessageWriteCallback ();
122123 static final OutboundEntityWriteCallback OUTBOUND_MESSAGE_BATCH_WRITE_CALLBACK =
@@ -2363,7 +2364,7 @@ public static class ClientParameters {
23632364 CompressionCodecFactory compressionCodecFactory ;
23642365 private String virtualHost = "/" ;
23652366 private Duration requestedHeartbeat = Duration .ofSeconds (60 );
2366- private int requestedMaxFrameSize = 1048576 ;
2367+ private int requestedMaxFrameSize = DEFAULT_MAX_FRAME_SIZE ;
23672368 private PublishConfirmListener publishConfirmListener = NO_OP_PUBLISH_CONFIRM_LISTENER ;
23682369 private PublishErrorListener publishErrorListener = NO_OP_PUBLISH_ERROR_LISTENER ;
23692370 private ChunkListener chunkListener =
Original file line number Diff line number Diff line change @@ -666,4 +666,16 @@ void creationShouldFailWithDetailsWhenUnknownHost() {
666666 .isInstanceOfAny (ConnectTimeoutException .class , UnknownHostException .class );
667667 }
668668 }
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+ }
669681}
You can’t perform that action at this time.
0 commit comments