This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 00b79411d11 CAMEL-18494: camel-mllp - Allow the ability to set 
MIN_BUFFER_SIZE for SocketBuffer
00b79411d11 is described below

commit 00b79411d11e20787fa72f1a61f55adac841b4ad
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Sep 15 13:41:19 2022 +0200

    CAMEL-18494: camel-mllp - Allow the ability to set MIN_BUFFER_SIZE for 
SocketBuffer
---
 .../org/apache/camel/catalog/components/mllp.json  |   4 +
 .../component/mllp/MllpComponentConfigurer.java    |  12 ++
 .../component/mllp/MllpEndpointConfigurer.java     |  12 ++
 .../component/mllp/MllpEndpointUriFactory.java     |   4 +-
 .../org/apache/camel/component/mllp/mllp.json      |   4 +
 .../camel/component/mllp/MllpConfiguration.java    |  35 +++-
 .../component/mllp/internal/MllpSocketBuffer.java  |  22 +--
 .../mllp/internal/MllpSocketBufferWriteTest.java   |  20 ++-
 .../component/dsl/MllpComponentBuilderFactory.java |  34 ++++
 .../endpoint/dsl/MllpEndpointBuilderFactory.java   | 200 +++++++++++++++++++++
 10 files changed, 327 insertions(+), 20 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mllp.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mllp.json
index 1b15e7ad4dc..a4e0ce027a9 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mllp.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mllp.json
@@ -47,6 +47,8 @@
     "defaultCharset": { "kind": "property", "displayName": "Default Charset", 
"group": "advanced", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "ISO-8859-1", "description": "Set the default 
character set to use for byte to\/from String conversions." },
     "logPhi": { "kind": "property", "displayName": "Log Phi", "group": 
"advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "true", "description": "Whether to log PHI" },
     "logPhiMaxBytes": { "kind": "property", "displayName": "Log Phi Max 
Bytes", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "5120", "description": "Set the maximum 
number of bytes of PHI that will be logged in a log entry." },
+    "maxBufferSize": { "kind": "property", "displayName": "Max Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 1073741824, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Maximum buffer size used when receiving or 
sending data over the wire." },
+    "minBufferSize": { "kind": "property", "displayName": "Min Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 2048, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Minimum buffer size used when receiving or 
sending data over the wire." },
     "readTimeout": { "kind": "property", "displayName": "Read Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 5000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
after the start of an MLLP frame has been received" },
     "receiveBufferSize": { "kind": "property", "displayName": "Receive Buffer 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "8192", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Sets the SO_RCVBUF option to the specified 
value (in bytes)" },
     "receiveTimeout": { "kind": "property", "displayName": "Receive Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 15000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
when waiting for the start of an MLLP frame" },
@@ -97,6 +99,8 @@
     "keepAlive": { "kind": "parameter", "displayName": "Keep Alive", "group": 
"producer", "label": "advanced,producer", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "true", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Enable\/disable the SO_KEEPALIVE socket 
option." },
     "tcpNoDelay": { "kind": "parameter", "displayName": "Tcp No Delay", 
"group": "producer", "label": "advanced,producer", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "true", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Enable\/disable the TCP_NODELAY socket 
option." },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start 
Producer", "group": "producer (advanced)", "label": "producer,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"description": "Whether the producer should be started lazy (on the first 
message). By starting lazy you can use this to allow CamelContext and routes to 
startup in situations where a producer may other [...]
+    "maxBufferSize": { "kind": "parameter", "displayName": "Max Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 1073741824, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Maximum buffer size used when receiving or 
sending data over the wire." },
+    "minBufferSize": { "kind": "parameter", "displayName": "Min Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 2048, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Minimum buffer size used when receiving or 
sending data over the wire." },
     "readTimeout": { "kind": "parameter", "displayName": "Read Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 5000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
after the start of an MLLP frame has been received" },
     "receiveBufferSize": { "kind": "parameter", "displayName": "Receive Buffer 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "8192", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Sets the SO_RCVBUF option to the specified 
value (in bytes)" },
     "receiveTimeout": { "kind": "parameter", "displayName": "Receive Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 15000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
when waiting for the start of an MLLP frame" },
diff --git 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpComponentConfigurer.java
 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpComponentConfigurer.java
index e38eac8f0b2..3ded6d98613 100644
--- 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpComponentConfigurer.java
+++ 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpComponentConfigurer.java
@@ -66,8 +66,12 @@ public class MllpComponentConfigurer extends 
PropertyConfigurerSupport implement
         case "logPhi": target.setLogPhi(property(camelContext, 
java.lang.Boolean.class, value)); return true;
         case "logphimaxbytes":
         case "logPhiMaxBytes": target.setLogPhiMaxBytes(property(camelContext, 
java.lang.Integer.class, value)); return true;
+        case "maxbuffersize":
+        case "maxBufferSize": 
getOrCreateConfiguration(target).setMaxBufferSize(property(camelContext, 
int.class, value)); return true;
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": 
getOrCreateConfiguration(target).setMaxConcurrentConsumers(property(camelContext,
 int.class, value)); return true;
+        case "minbuffersize":
+        case "minBufferSize": 
getOrCreateConfiguration(target).setMinBufferSize(property(camelContext, 
int.class, value)); return true;
         case "readtimeout":
         case "readTimeout": 
getOrCreateConfiguration(target).setReadTimeout(property(camelContext, 
int.class, value)); return true;
         case "receivebuffersize":
@@ -131,8 +135,12 @@ public class MllpComponentConfigurer extends 
PropertyConfigurerSupport implement
         case "logPhi": return java.lang.Boolean.class;
         case "logphimaxbytes":
         case "logPhiMaxBytes": return java.lang.Integer.class;
+        case "maxbuffersize":
+        case "maxBufferSize": return int.class;
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": return int.class;
+        case "minbuffersize":
+        case "minBufferSize": return int.class;
         case "readtimeout":
         case "readTimeout": return int.class;
         case "receivebuffersize":
@@ -197,8 +205,12 @@ public class MllpComponentConfigurer extends 
PropertyConfigurerSupport implement
         case "logPhi": return target.getLogPhi();
         case "logphimaxbytes":
         case "logPhiMaxBytes": return target.getLogPhiMaxBytes();
+        case "maxbuffersize":
+        case "maxBufferSize": return 
getOrCreateConfiguration(target).getMaxBufferSize();
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": return 
getOrCreateConfiguration(target).getMaxConcurrentConsumers();
+        case "minbuffersize":
+        case "minBufferSize": return 
getOrCreateConfiguration(target).getMinBufferSize();
         case "readtimeout":
         case "readTimeout": return 
getOrCreateConfiguration(target).getReadTimeout();
         case "receivebuffersize":
diff --git 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointConfigurer.java
 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointConfigurer.java
index 6d754a421b0..8a9b7991432 100644
--- 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointConfigurer.java
+++ 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointConfigurer.java
@@ -52,8 +52,12 @@ public class MllpEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "lazyStartProducer": 
target.setLazyStartProducer(property(camelContext, boolean.class, value)); 
return true;
         case "lenientbind":
         case "lenientBind": 
target.getConfiguration().setLenientBind(property(camelContext, boolean.class, 
value)); return true;
+        case "maxbuffersize":
+        case "maxBufferSize": 
target.getConfiguration().setMaxBufferSize(property(camelContext, int.class, 
value)); return true;
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": 
target.getConfiguration().setMaxConcurrentConsumers(property(camelContext, 
int.class, value)); return true;
+        case "minbuffersize":
+        case "minBufferSize": 
target.getConfiguration().setMinBufferSize(property(camelContext, int.class, 
value)); return true;
         case "readtimeout":
         case "readTimeout": 
target.getConfiguration().setReadTimeout(property(camelContext, int.class, 
value)); return true;
         case "receivebuffersize":
@@ -110,8 +114,12 @@ public class MllpEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "lazyStartProducer": return boolean.class;
         case "lenientbind":
         case "lenientBind": return boolean.class;
+        case "maxbuffersize":
+        case "maxBufferSize": return int.class;
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": return int.class;
+        case "minbuffersize":
+        case "minBufferSize": return int.class;
         case "readtimeout":
         case "readTimeout": return int.class;
         case "receivebuffersize":
@@ -169,8 +177,12 @@ public class MllpEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "lazyStartProducer": return target.isLazyStartProducer();
         case "lenientbind":
         case "lenientBind": return target.getConfiguration().isLenientBind();
+        case "maxbuffersize":
+        case "maxBufferSize": return 
target.getConfiguration().getMaxBufferSize();
         case "maxconcurrentconsumers":
         case "maxConcurrentConsumers": return 
target.getConfiguration().getMaxConcurrentConsumers();
+        case "minbuffersize":
+        case "minBufferSize": return 
target.getConfiguration().getMinBufferSize();
         case "readtimeout":
         case "readTimeout": return target.getConfiguration().getReadTimeout();
         case "receivebuffersize":
diff --git 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointUriFactory.java
 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointUriFactory.java
index 40ef6f0c68c..807af8b1549 100644
--- 
a/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointUriFactory.java
+++ 
b/components/camel-mllp/src/generated/java/org/apache/camel/component/mllp/MllpEndpointUriFactory.java
@@ -21,7 +21,7 @@ public class MllpEndpointUriFactory extends 
org.apache.camel.support.component.E
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(28);
+        Set<String> props = new HashSet<>(30);
         props.add("acceptTimeout");
         props.add("autoAck");
         props.add("backlog");
@@ -39,7 +39,9 @@ public class MllpEndpointUriFactory extends 
org.apache.camel.support.component.E
         props.add("keepAlive");
         props.add("lazyStartProducer");
         props.add("lenientBind");
+        props.add("maxBufferSize");
         props.add("maxConcurrentConsumers");
+        props.add("minBufferSize");
         props.add("port");
         props.add("readTimeout");
         props.add("receiveBufferSize");
diff --git 
a/components/camel-mllp/src/generated/resources/org/apache/camel/component/mllp/mllp.json
 
b/components/camel-mllp/src/generated/resources/org/apache/camel/component/mllp/mllp.json
index 1b15e7ad4dc..a4e0ce027a9 100644
--- 
a/components/camel-mllp/src/generated/resources/org/apache/camel/component/mllp/mllp.json
+++ 
b/components/camel-mllp/src/generated/resources/org/apache/camel/component/mllp/mllp.json
@@ -47,6 +47,8 @@
     "defaultCharset": { "kind": "property", "displayName": "Default Charset", 
"group": "advanced", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "ISO-8859-1", "description": "Set the default 
character set to use for byte to\/from String conversions." },
     "logPhi": { "kind": "property", "displayName": "Log Phi", "group": 
"advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "true", "description": "Whether to log PHI" },
     "logPhiMaxBytes": { "kind": "property", "displayName": "Log Phi Max 
Bytes", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "5120", "description": "Set the maximum 
number of bytes of PHI that will be logged in a log entry." },
+    "maxBufferSize": { "kind": "property", "displayName": "Max Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 1073741824, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Maximum buffer size used when receiving or 
sending data over the wire." },
+    "minBufferSize": { "kind": "property", "displayName": "Min Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 2048, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Minimum buffer size used when receiving or 
sending data over the wire." },
     "readTimeout": { "kind": "property", "displayName": "Read Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 5000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
after the start of an MLLP frame has been received" },
     "receiveBufferSize": { "kind": "property", "displayName": "Receive Buffer 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "8192", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Sets the SO_RCVBUF option to the specified 
value (in bytes)" },
     "receiveTimeout": { "kind": "property", "displayName": "Receive Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 15000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
when waiting for the start of an MLLP frame" },
@@ -97,6 +99,8 @@
     "keepAlive": { "kind": "parameter", "displayName": "Keep Alive", "group": 
"producer", "label": "advanced,producer", "required": false, "type": "boolean", 
"javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "true", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Enable\/disable the SO_KEEPALIVE socket 
option." },
     "tcpNoDelay": { "kind": "parameter", "displayName": "Tcp No Delay", 
"group": "producer", "label": "advanced,producer", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "true", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Enable\/disable the TCP_NODELAY socket 
option." },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start 
Producer", "group": "producer (advanced)", "label": "producer,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"description": "Whether the producer should be started lazy (on the first 
message). By starting lazy you can use this to allow CamelContext and routes to 
startup in situations where a producer may other [...]
+    "maxBufferSize": { "kind": "parameter", "displayName": "Max Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 1073741824, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Maximum buffer size used when receiving or 
sending data over the wire." },
+    "minBufferSize": { "kind": "parameter", "displayName": "Min Buffer Size", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 2048, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Minimum buffer size used when receiving or 
sending data over the wire." },
     "readTimeout": { "kind": "parameter", "displayName": "Read Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 5000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
after the start of an MLLP frame has been received" },
     "receiveBufferSize": { "kind": "parameter", "displayName": "Receive Buffer 
Size", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "8192", "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "Sets the SO_RCVBUF option to the specified 
value (in bytes)" },
     "receiveTimeout": { "kind": "parameter", "displayName": "Receive Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": "integer", 
"javaType": "int", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": 15000, "configurationClass": 
"org.apache.camel.component.mllp.MllpConfiguration", "configurationField": 
"configuration", "description": "The SO_TIMEOUT value (in milliseconds) used 
when waiting for the start of an MLLP frame" },
diff --git 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpConfiguration.java
 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpConfiguration.java
index 996141d00eb..09727227fd3 100644
--- 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpConfiguration.java
+++ 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpConfiguration.java
@@ -105,6 +105,11 @@ public class MllpConfiguration implements Cloneable {
     @UriParam(label = "advanced,producer", defaultValue = "RESET")
     MllpIdleTimeoutStrategy idleTimeoutStrategy = 
MllpIdleTimeoutStrategy.RESET;
 
+    @UriParam(label = "advanced", defaultValue = "2048")
+    int minBufferSize = 2048;
+    @UriParam(label = "advanced", defaultValue = "" + 0x40000000)
+    int maxBufferSize = 0x40000000;
+
     public MllpConfiguration() {
     }
 
@@ -529,6 +534,28 @@ public class MllpConfiguration implements Cloneable {
         this.idleTimeoutStrategy = idleTimeoutStrategy;
     }
 
+    public int getMinBufferSize() {
+        return minBufferSize;
+    }
+
+    /**
+     * Minimum buffer size used when receiving or sending data over the wire.
+     */
+    public void setMinBufferSize(int minBufferSize) {
+        this.minBufferSize = minBufferSize;
+    }
+
+    /**
+     * Maximum buffer size used when receiving or sending data over the wire.
+     */
+    public int getMaxBufferSize() {
+        return maxBufferSize;
+    }
+
+    public void setMaxBufferSize(int maxBufferSize) {
+        this.maxBufferSize = maxBufferSize;
+    }
+
     @Override
     public int hashCode() {
         return Objects.hash(bridgeErrorHandler,
@@ -553,7 +580,9 @@ public class MllpConfiguration implements Cloneable {
                 requireEndOfData,
                 stringPayload,
                 validatePayload,
-                charsetName);
+                charsetName,
+                minBufferSize,
+                maxBufferSize);
     }
 
     @Override
@@ -582,6 +611,8 @@ public class MllpConfiguration implements Cloneable {
                 && stringPayload == rhs.stringPayload
                 && validatePayload == rhs.validatePayload
                 && idleTimeoutStrategy == rhs.idleTimeoutStrategy
+                && minBufferSize == rhs.minBufferSize
+                && maxBufferSize == rhs.maxBufferSize
                 && Objects.equals(backlog, rhs.backlog)
                 && Objects.equals(maxConcurrentConsumers, 
rhs.maxConcurrentConsumers)
                 && Objects.equals(idleTimeout, rhs.idleTimeout)
@@ -618,6 +649,8 @@ public class MllpConfiguration implements Cloneable {
                + ", requireEndOfData=" + requireEndOfData
                + ", stringPayload=" + stringPayload
                + ", validatePayload=" + validatePayload
+               + ", minBufferSize=" + minBufferSize
+               + ", maxBufferSize=" + maxBufferSize
                + ", charsetName='" + charsetName + '\''
                + '}';
     }
diff --git 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
index 0a30455b8dd..055fe1c0aaf 100644
--- 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
+++ 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
@@ -36,8 +36,6 @@ import org.slf4j.LoggerFactory;
  * An OutputStream modeled after the ByteArrayOutputStream specifically for 
MLLP operations.
  */
 public class MllpSocketBuffer {
-    static final int MIN_BUFFER_SIZE = 2048;
-    static final int MAX_BUFFER_SIZE = 0x40000000;  // Approximately 1-GB
 
     private static final Logger LOG = 
LoggerFactory.getLogger(MllpSocketBuffer.class);
     final MllpEndpoint endpoint;
@@ -49,6 +47,8 @@ public class MllpSocketBuffer {
     int endOfBlockIndex = -1;
     String charset;
     Hl7Util hl7Util;
+    int minBufferSize;
+    int maxBufferSize;
 
     public MllpSocketBuffer(MllpEndpoint endpoint) {
         if (endpoint == null) {
@@ -58,8 +58,10 @@ public class MllpSocketBuffer {
         this.charset = endpoint.getCharsetName();
         MllpComponent component = endpoint.getComponent();
         this.hl7Util = new Hl7Util(component.getLogPhiMaxBytes(), 
component.getLogPhi());
+        this.minBufferSize = endpoint.getConfiguration().getMinBufferSize();
+        this.maxBufferSize = endpoint.getConfiguration().getMaxBufferSize();
 
-        buffer = new byte[MIN_BUFFER_SIZE];
+        buffer = new byte[minBufferSize];
     }
 
     public boolean isEndOfDataRequired() {
@@ -179,7 +181,7 @@ public class MllpSocketBuffer {
             throws MllpSocketException, SocketTimeoutException {
         if (socket != null && socket.isConnected() && !socket.isClosed()) {
             LOG.trace("readFrom({}, {}, {}) - entering", socket, 
receiveTimeout, readTimeout);
-            ensureCapacity(MIN_BUFFER_SIZE);
+            ensureCapacity(minBufferSize);
 
             try {
                 InputStream socketInputStream = socket.getInputStream();
@@ -191,7 +193,7 @@ public class MllpSocketBuffer {
                     socket.setSoTimeout(readTimeout);
 
                     while (!hasCompleteEnvelope()) {
-                        ensureCapacity(Math.max(MIN_BUFFER_SIZE, 
socketInputStream.available()));
+                        ensureCapacity(Math.max(minBufferSize, 
socketInputStream.available()));
                         readSocketInputStream(socketInputStream, socket);
                     }
                 }
@@ -507,20 +509,20 @@ public class MllpSocketBuffer {
         if (requiredAvailableCapacity > currentAvailableCapacity) {
             int requiredBufferSize = buffer.length + 
(requiredAvailableCapacity - currentAvailableCapacity);
 
-            if (buffer.length >= MAX_BUFFER_SIZE) {
+            if (buffer.length >= maxBufferSize) {
                 final String exceptionMessageFormat = "Cannot increase the 
buffer size from <%d> to <%d>"
                                                       + " in order to increase 
the available capacity from <%d> to <%d> because the buffer is already the 
maximum size <%d>";
                 throw new IllegalStateException(
                         String.format(exceptionMessageFormat, buffer.length, 
requiredBufferSize, currentAvailableCapacity,
-                                requiredAvailableCapacity, MAX_BUFFER_SIZE));
-            } else if (requiredBufferSize > MAX_BUFFER_SIZE) {
+                                requiredAvailableCapacity, maxBufferSize));
+            } else if (requiredBufferSize > maxBufferSize) {
                 final String exceptionMessageFormat = "Cannot increase the 
buffer size <%d>"
                                                       + " in order to increase 
the available capacity from <%d> to <%d> because the required buffer size <%d> 
exceeds the maximum buffer size <%d>";
                 throw new IllegalStateException(
                         String.format(exceptionMessageFormat, buffer.length, 
currentAvailableCapacity,
-                                requiredAvailableCapacity, requiredBufferSize, 
MAX_BUFFER_SIZE));
+                                requiredAvailableCapacity, requiredBufferSize, 
maxBufferSize));
             }
-            int newBufferSize = Math.min(buffer.length + 
Math.max(MIN_BUFFER_SIZE, requiredAvailableCapacity), MAX_BUFFER_SIZE);
+            int newBufferSize = Math.min(buffer.length + 
Math.max(minBufferSize, requiredAvailableCapacity), maxBufferSize);
 
             buffer = Arrays.copyOf(buffer, newBufferSize);
         }
diff --git 
a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/MllpSocketBufferWriteTest.java
 
b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/MllpSocketBufferWriteTest.java
index 19f30ada6ce..dc73acf135b 100644
--- 
a/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/MllpSocketBufferWriteTest.java
+++ 
b/components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/MllpSocketBufferWriteTest.java
@@ -30,6 +30,10 @@ import static org.junit.jupiter.api.Assertions.fail;
  * Tests for the overridden methods in the MllpSocketBuffer class.
  */
 public class MllpSocketBufferWriteTest extends SocketBufferTestSupport {
+
+    static final int MIN_BUFFER_SIZE = 2048;
+    static final int MAX_BUFFER_SIZE = 0x40000000;  // Approximately 1-GB
+
     /**
      * Description of test.
      *
@@ -288,11 +292,11 @@ public class MllpSocketBufferWriteTest extends 
SocketBufferTestSupport {
      */
     @Test
     public void testEnsureCapacityWithNegativeRequiredAvailability() {
-        assertEquals(MllpSocketBuffer.MIN_BUFFER_SIZE, instance.capacity());
+        assertEquals(MIN_BUFFER_SIZE, instance.capacity());
 
         instance.ensureCapacity(-1);
 
-        assertEquals(MllpSocketBuffer.MIN_BUFFER_SIZE, instance.capacity());
+        assertEquals(MIN_BUFFER_SIZE, instance.capacity());
     }
 
     /**
@@ -301,7 +305,7 @@ public class MllpSocketBufferWriteTest extends 
SocketBufferTestSupport {
      */
     @Test
     public void testEnsureCapacityWithOutOfRangeRequiredAvailability() {
-        assertEquals(MllpSocketBuffer.MIN_BUFFER_SIZE, instance.capacity());
+        assertEquals(MIN_BUFFER_SIZE, instance.capacity());
 
         try {
             instance.ensureCapacity(Integer.MAX_VALUE);
@@ -314,7 +318,7 @@ public class MllpSocketBufferWriteTest extends 
SocketBufferTestSupport {
         }
 
         try {
-            instance.ensureCapacity(MllpSocketBuffer.MAX_BUFFER_SIZE + 1);
+            instance.ensureCapacity(MAX_BUFFER_SIZE + 1);
             fail("Should have thrown an exception");
         } catch (IllegalStateException expectedEx) {
             String expectedMessage
@@ -325,7 +329,7 @@ public class MllpSocketBufferWriteTest extends 
SocketBufferTestSupport {
 
         instance.write("BLAH".getBytes());
         IllegalStateException expectedEx = 
assertThrows(IllegalStateException.class,
-                () -> 
instance.ensureCapacity(MllpSocketBuffer.MAX_BUFFER_SIZE));
+                () -> instance.ensureCapacity(MAX_BUFFER_SIZE));
         String expectedMessage
                 = "Cannot increase the buffer size <2048> in order to increase 
the available capacity from <2044> to <1073741824>"
                   + " because the required buffer size <1073741828> exceeds 
the maximum buffer size <1073741824>";
@@ -338,12 +342,12 @@ public class MllpSocketBufferWriteTest extends 
SocketBufferTestSupport {
      */
     @Test
     public void testEnsureCapacityWithAlreadyAllocateMaxBufferSize() {
-        assertEquals(MllpSocketBuffer.MIN_BUFFER_SIZE, instance.capacity());
+        assertEquals(MIN_BUFFER_SIZE, instance.capacity());
 
-        instance.ensureCapacity(MllpSocketBuffer.MAX_BUFFER_SIZE);
+        instance.ensureCapacity(MAX_BUFFER_SIZE);
 
         IllegalStateException expectedEx = 
assertThrows(IllegalStateException.class,
-                () -> instance.ensureCapacity(MllpSocketBuffer.MAX_BUFFER_SIZE 
+ 1));
+                () -> instance.ensureCapacity(MAX_BUFFER_SIZE + 1));
         String expectedMessage
                 = "Cannot increase the buffer size from <1073741824> to 
<1073741825> in order to increase the available capacity"
                   + " from <1073741824> to <1073741825> because the buffer is 
already the maximum size <1073741824>";
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MllpComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MllpComponentBuilderFactory.java
index 80323a10481..5cc482fd6c9 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MllpComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/MllpComponentBuilderFactory.java
@@ -481,6 +481,38 @@ public interface MllpComponentBuilderFactory {
             doSetProperty("logPhiMaxBytes", logPhiMaxBytes);
             return this;
         }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default MllpComponentBuilder maxBufferSize(int maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default MllpComponentBuilder minBufferSize(int minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
         /**
          * The SO_TIMEOUT value (in milliseconds) used after the start of an
          * MLLP frame has been received.
@@ -610,6 +642,8 @@ public interface MllpComponentBuilderFactory {
             case "defaultCharset": ((MllpComponent) 
component).setDefaultCharset((java.lang.String) value); return true;
             case "logPhi": ((MllpComponent) 
component).setLogPhi((java.lang.Boolean) value); return true;
             case "logPhiMaxBytes": ((MllpComponent) 
component).setLogPhiMaxBytes((java.lang.Integer) value); return true;
+            case "maxBufferSize": getOrCreateConfiguration((MllpComponent) 
component).setMaxBufferSize((int) value); return true;
+            case "minBufferSize": getOrCreateConfiguration((MllpComponent) 
component).setMinBufferSize((int) value); return true;
             case "readTimeout": getOrCreateConfiguration((MllpComponent) 
component).setReadTimeout((int) value); return true;
             case "receiveBufferSize": getOrCreateConfiguration((MllpComponent) 
component).setReceiveBufferSize((java.lang.Integer) value); return true;
             case "receiveTimeout": getOrCreateConfiguration((MllpComponent) 
component).setReceiveTimeout((int) value); return true;
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MllpEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MllpEndpointBuilderFactory.java
index a3fc248610a..b01f9c41b0d 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MllpEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MllpEndpointBuilderFactory.java
@@ -620,6 +620,74 @@ public interface MllpEndpointBuilderFactory {
             doSetProperty("exchangePattern", exchangePattern);
             return this;
         }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointConsumerBuilder maxBufferSize(
+                int maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointConsumerBuilder maxBufferSize(
+                String maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointConsumerBuilder minBufferSize(
+                int minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointConsumerBuilder minBufferSize(
+                String minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
         /**
          * The SO_TIMEOUT value (in milliseconds) used after the start of an
          * MLLP frame has been received.
@@ -1201,6 +1269,74 @@ public interface MllpEndpointBuilderFactory {
             doSetProperty("lazyStartProducer", lazyStartProducer);
             return this;
         }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointProducerBuilder maxBufferSize(
+                int maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointProducerBuilder maxBufferSize(
+                String maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointProducerBuilder minBufferSize(
+                int minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointProducerBuilder minBufferSize(
+                String minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
         /**
          * The SO_TIMEOUT value (in milliseconds) used after the start of an
          * MLLP frame has been received.
@@ -1596,6 +1732,70 @@ public interface MllpEndpointBuilderFactory {
         default MllpEndpointBuilder basic() {
             return (MllpEndpointBuilder) this;
         }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointBuilder maxBufferSize(int maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Maximum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 1073741824
+         * Group: advanced
+         * 
+         * @param maxBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointBuilder maxBufferSize(String 
maxBufferSize) {
+            doSetProperty("maxBufferSize", maxBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option is a: &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointBuilder minBufferSize(int minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
+        /**
+         * Minimum buffer size used when receiving or sending data over the
+         * wire.
+         * 
+         * The option will be converted to a &lt;code&gt;int&lt;/code&gt; type.
+         * 
+         * Default: 2048
+         * Group: advanced
+         * 
+         * @param minBufferSize the value to set
+         * @return the dsl builder
+         */
+        default AdvancedMllpEndpointBuilder minBufferSize(String 
minBufferSize) {
+            doSetProperty("minBufferSize", minBufferSize);
+            return this;
+        }
         /**
          * The SO_TIMEOUT value (in milliseconds) used after the start of an
          * MLLP frame has been received.

Reply via email to