This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 58603c5 CAMEL-13392 camel-bindy - Add allowEmptyStream option (#3227)
58603c5 is described below
commit 58603c5e2b9923016192e28085b1d988ccccb2a3
Author: José Ortiz <[email protected]>
AuthorDate: Mon Oct 7 22:41:22 2019 -0500
CAMEL-13392 camel-bindy - Add allowEmptyStream option (#3227)
* CAMEL-13392 camel-bindy - Add allowEmptyStream option
* Rebuilt documentation and spring boot modules.
---
.../src/main/docs/bindy-dataformat.adoc | 8 ++-
.../dataformat/bindy/BindyAbstractDataFormat.java | 9 +++
.../dataformat/bindy/csv/BindyCsvDataFormat.java | 2 +-
.../bindy/fixed/BindyFixedLengthDataFormat.java | 2 +-
.../bindy/kvp/BindyKeyValuePairDataFormat.java | 2 +-
.../BindyComplexCsvUnmarshallEmptyStreamTest.java | 67 ++++++++++++++++++++++
...ComplexCsvUnmarshallEmptyStreamTest-context.xml | 34 +++++++++++
.../camel/model/dataformat/BindyDataFormat.java | 15 +++++
.../reifier/dataformat/BindyDataFormatReifier.java | 3 +
.../modules/ROOT/pages/bindy-dataformat.adoc | 8 ++-
.../BindyCsvDataFormatConfiguration.java | 13 +++++
.../BindyFixedLengthDataFormatConfiguration.java | 13 +++++
.../BindyKeyValuePairDataFormatConfiguration.java | 13 +++++
13 files changed, 182 insertions(+), 7 deletions(-)
diff --git a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
index c4fbef6..e56c521 100644
--- a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
+++ b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
@@ -52,7 +52,7 @@ you can put multiple models in the same package.
== Options
// dataformat options: START
-The Bindy dataformat supports 5 options, which are listed below.
+The Bindy dataformat supports 6 options, which are listed below.
@@ -63,6 +63,7 @@ The Bindy dataformat supports 5 options, which are listed
below.
| classType | | String | Name of model class to use.
| locale | | String | To configure a default locale to use, such as us for
united states. To use the JVM platform default locale then use the name default
| unwrapSingleInstance | true | Boolean | When unmarshalling should a single
instance be unwrapped and returned instead of wrapped in a java.util.List.
+| allowEmptyStream | false | Boolean | Whether to allow empty streams in the
unmarshal process. If true, no exception will be thrown when a body without
records is provided.
| contentTypeHeader | false | Boolean | Whether the data format should set the
Content-Type header with the type from the data format if the data format is
capable of doing so. For example application/xml for data formats marshalling
to XML, or application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
@@ -82,25 +83,28 @@ When using Spring Boot make sure to use the following Maven
dependency to have s
----
-The component supports 18 options, which are listed below.
+The component supports 21 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *camel.dataformat.bindy-csv.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-csv.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-csv.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-csv.enabled* | Enable bindy-csv dataformat | true |
Boolean
| *camel.dataformat.bindy-csv.locale* | To configure a default locale to use,
such as us for united states. To use the JVM platform default locale then use
the name default | | String
| *camel.dataformat.bindy-csv.type* | Whether to use Csv, Fixed, or KeyValue.
| | String
| *camel.dataformat.bindy-csv.unwrap-single-instance* | When unmarshalling
should a single instance be unwrapped and returned instead of wrapped in a
java.util.List. | true | Boolean
+| *camel.dataformat.bindy-fixed.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-fixed.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-fixed.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-fixed.enabled* | Enable bindy-fixed dataformat |
true | Boolean
| *camel.dataformat.bindy-fixed.locale* | To configure a default locale to
use, such as us for united states. To use the JVM platform default locale then
use the name default | | String
| *camel.dataformat.bindy-fixed.type* | Whether to use Csv, Fixed, or
KeyValue. | | String
| *camel.dataformat.bindy-fixed.unwrap-single-instance* | When unmarshalling
should a single instance be unwrapped and returned instead of wrapped in a
java.util.List. | true | Boolean
+| *camel.dataformat.bindy-kvp.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-kvp.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-kvp.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-kvp.enabled* | Enable bindy-kvp dataformat | true |
Boolean
diff --git
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
index 84392bb..3ad2604 100644
---
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
+++
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractDataFormat.java
@@ -48,6 +48,7 @@ public abstract class BindyAbstractDataFormat extends
ServiceSupport implements
private Class<?> classType;
private CamelContext camelContext;
private boolean unwrapSingleInstance = true;
+ private boolean allowEmptyStream = false;
public BindyAbstractDataFormat() {
}
@@ -80,6 +81,14 @@ public abstract class BindyAbstractDataFormat extends
ServiceSupport implements
this.unwrapSingleInstance = unwrapSingleInstance;
}
+ public boolean isAllowEmptyStream() {
+ return allowEmptyStream;
+ }
+
+ public void setAllowEmptyStream(boolean allowEmptyStream) {
+ this.allowEmptyStream = allowEmptyStream;
+ }
+
public BindyAbstractFactory getFactory() throws Exception {
if (modelFactory == null) {
FormatFactory formatFactory = createFormatFactory();
diff --git
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index d676253..cf444a1 100644
---
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -183,7 +183,7 @@ public class BindyCsvDataFormat extends
BindyAbstractDataFormat {
// BigIntegerFormatFactory if models list is empty or not
// If this is the case (correspond to an empty stream, ...)
- if (models.size() == 0) {
+ if (models.isEmpty() && !isAllowEmptyStream()) {
throw new java.lang.IllegalArgumentException("No records
have been defined in the CSV");
} else {
return extractUnmarshalResult(models);
diff --git
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
index 024c3bc..5bc7d68 100644
---
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
+++
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
@@ -248,7 +248,7 @@ public class BindyFixedLengthDataFormat extends
BindyAbstractDataFormat {
// BigIntegerFormatFactory if models list is empty or not
// If this is the case (correspond to an empty stream, ...)
- if (models.size() == 0) {
+ if (models.isEmpty() && !isAllowEmptyStream()) {
throw new java.lang.IllegalArgumentException("No records have
been defined in the file");
} else {
return extractUnmarshalResult(models);
diff --git
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
index 5a6dd42..dfc468e 100644
---
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
+++
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/kvp/BindyKeyValuePairDataFormat.java
@@ -121,7 +121,7 @@ public class BindyKeyValuePairDataFormat extends
BindyAbstractDataFormat {
// BigIntegerFormatFactory if models list is empty or not
// If this is the case (correspond to an empty stream, ...)
- if (models.size() == 0) {
+ if (models.isEmpty() && !isAllowEmptyStream()) {
throw new java.lang.IllegalArgumentException("No records have
been defined in the CSV");
} else {
return extractUnmarshalResult(models);
diff --git
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest.java
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest.java
new file mode 100644
index 0000000..57f0ac8
--- /dev/null
+++
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dataformat.bindy.csv;
+
+import java.util.List;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.test.context.ContextConfiguration;
+import
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+@ContextConfiguration
+public class BindyComplexCsvUnmarshallEmptyStreamTest extends
AbstractJUnit4SpringContextTests {
+
+ private static final Class<?> TYPE =
org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order.class;
+
+ @Produce("direct:start")
+ protected ProducerTemplate template;
+
+ private String emptyRecords = "";
+ @EndpointInject("mock:result")
+ private MockEndpoint resultEndpoint;
+
+ @Test
+ public void testUnMarshallMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(1);
+ resultEndpoint.message(0).body().isInstanceOf(List.class);
+
+ template.sendBody(emptyRecords);
+
+ resultEndpoint.assertIsSatisfied();
+
+ // there should be an empty list and no exception should be thrown
+ List list =
resultEndpoint.getReceivedExchanges().get(0).getIn().getBody(List.class);
+ Assert.assertEquals(0, list.size());
+ }
+
+ public static class ContextConfig extends RouteBuilder {
+ @Override
+ public void configure() {
+ BindyCsvDataFormat bindyCsvDataFormat = new BindyCsvDataFormat(TYPE);
+ bindyCsvDataFormat.setAllowEmptyStream(true);
+ from("direct:start")
+ .unmarshal(bindyCsvDataFormat)
+ .to("mock:result");
+ }
+ }
+}
diff --git
a/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest-context.xml
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest-context.xml
new file mode 100644
index 0000000..8a8f6d2
--- /dev/null
+++
b/components/camel-bindy/src/test/resources/org/apache/camel/dataformat/bindy/csv/BindyComplexCsvUnmarshallEmptyStreamTest-context.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring
+ http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <routeBuilder ref="myBuilder" />
+ </camelContext>
+
+ <bean id="myBuilder"
class="org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallEmptyStreamTest$ContextConfig"/>
+
+</beans>
\ No newline at end of file
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 262227b..001eca9 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -42,6 +42,9 @@ public class BindyDataFormat extends DataFormatDefinition {
@XmlAttribute
@Metadata(defaultValue = "true")
private Boolean unwrapSingleInstance;
+ @XmlAttribute
+ @Metadata(defaultValue = "false")
+ private Boolean allowEmptyStream;
@XmlTransient
private Class<?> clazz;
@@ -108,4 +111,16 @@ public class BindyDataFormat extends DataFormatDefinition {
this.unwrapSingleInstance = unwrapSingleInstance;
}
+ public Boolean getAllowEmptyStream() {
+ return allowEmptyStream;
+ }
+
+ /**
+ * Whether to allow empty streams in the unmarshal process. If true, no
+ * exception will be thrown when a body without records is provided.
+ */
+ public void setAllowEmptyStream(Boolean allowEmptyStream) {
+ this.allowEmptyStream = allowEmptyStream;
+ }
+
}
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/BindyDataFormatReifier.java
b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/BindyDataFormatReifier.java
index 920e43a..46c790a 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/BindyDataFormatReifier.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/reifier/dataformat/BindyDataFormatReifier.java
@@ -60,6 +60,9 @@ public class BindyDataFormatReifier extends
DataFormatReifier<BindyDataFormat> {
if (definition.getUnwrapSingleInstance() != null) {
setProperty(camelContext, dataFormat, "unwrapSingleInstance",
definition.getUnwrapSingleInstance());
}
+ if (definition.getAllowEmptyStream() != null) {
+ setProperty(camelContext, dataFormat, "allowEmptyStream",
definition.getAllowEmptyStream());
+ }
}
}
diff --git a/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
b/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
index 7821c9f..a115b4d 100644
--- a/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
@@ -53,7 +53,7 @@ you can put multiple models in the same package.
== Options
// dataformat options: START
-The Bindy dataformat supports 5 options, which are listed below.
+The Bindy dataformat supports 6 options, which are listed below.
@@ -64,6 +64,7 @@ The Bindy dataformat supports 5 options, which are listed
below.
| classType | | String | Name of model class to use.
| locale | | String | To configure a default locale to use, such as us for
united states. To use the JVM platform default locale then use the name default
| unwrapSingleInstance | true | Boolean | When unmarshalling should a single
instance be unwrapped and returned instead of wrapped in a java.util.List.
+| allowEmptyStream | false | Boolean | Whether to allow empty streams in the
unmarshal process. If true, no exception will be thrown when a body without
records is provided.
| contentTypeHeader | false | Boolean | Whether the data format should set the
Content-Type header with the type from the data format if the data format is
capable of doing so. For example application/xml for data formats marshalling
to XML, or application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
@@ -83,25 +84,28 @@ When using Spring Boot make sure to use the following Maven
dependency to have s
----
-The component supports 18 options, which are listed below.
+The component supports 21 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
+| *camel.dataformat.bindy-csv.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-csv.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-csv.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-csv.enabled* | Enable bindy-csv dataformat | true |
Boolean
| *camel.dataformat.bindy-csv.locale* | To configure a default locale to use,
such as us for united states. To use the JVM platform default locale then use
the name default | | String
| *camel.dataformat.bindy-csv.type* | Whether to use Csv, Fixed, or KeyValue.
| | String
| *camel.dataformat.bindy-csv.unwrap-single-instance* | When unmarshalling
should a single instance be unwrapped and returned instead of wrapped in a
java.util.List. | true | Boolean
+| *camel.dataformat.bindy-fixed.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-fixed.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-fixed.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-fixed.enabled* | Enable bindy-fixed dataformat |
true | Boolean
| *camel.dataformat.bindy-fixed.locale* | To configure a default locale to
use, such as us for united states. To use the JVM platform default locale then
use the name default | | String
| *camel.dataformat.bindy-fixed.type* | Whether to use Csv, Fixed, or
KeyValue. | | String
| *camel.dataformat.bindy-fixed.unwrap-single-instance* | When unmarshalling
should a single instance be unwrapped and returned instead of wrapped in a
java.util.List. | true | Boolean
+| *camel.dataformat.bindy-kvp.allow-empty-stream* | Whether to allow empty
streams in the unmarshal process. If true, no exception will be thrown when a
body without records is provided. | false | Boolean
| *camel.dataformat.bindy-kvp.class-type* | Name of model class to use. | |
String
| *camel.dataformat.bindy-kvp.content-type-header* | Whether the data format
should set the Content-Type header with the type from the data format if the
data format is capable of doing so. For example application/xml for data
formats marshalling to XML, or application/json for data formats marshalling to
JSon etc. | false | Boolean
| *camel.dataformat.bindy-kvp.enabled* | Enable bindy-kvp dataformat | true |
Boolean
diff --git
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatConfiguration.java
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatConfiguration.java
index 696cb10..c2d76d4 100644
---
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatConfiguration.java
+++
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatConfiguration.java
@@ -56,6 +56,11 @@ public class BindyCsvDataFormatConfiguration
*/
private Boolean unwrapSingleInstance = true;
/**
+ * Whether to allow empty streams in the unmarshal process. If true, no
+ * exception will be thrown when a body without records is provided.
+ */
+ private Boolean allowEmptyStream = false;
+ /**
* Whether the data format should set the Content-Type header with the type
* from the data format if the data format is capable of doing so. For
* example application/xml for data formats marshalling to XML, or
@@ -95,6 +100,14 @@ public class BindyCsvDataFormatConfiguration
this.unwrapSingleInstance = unwrapSingleInstance;
}
+ public Boolean getAllowEmptyStream() {
+ return allowEmptyStream;
+ }
+
+ public void setAllowEmptyStream(Boolean allowEmptyStream) {
+ this.allowEmptyStream = allowEmptyStream;
+ }
+
public Boolean getContentTypeHeader() {
return contentTypeHeader;
}
diff --git
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatConfiguration.java
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatConfiguration.java
index eb354f8..ee9579c 100644
---
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatConfiguration.java
+++
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatConfiguration.java
@@ -56,6 +56,11 @@ public class BindyFixedLengthDataFormatConfiguration
*/
private Boolean unwrapSingleInstance = true;
/**
+ * Whether to allow empty streams in the unmarshal process. If true, no
+ * exception will be thrown when a body without records is provided.
+ */
+ private Boolean allowEmptyStream = false;
+ /**
* Whether the data format should set the Content-Type header with the type
* from the data format if the data format is capable of doing so. For
* example application/xml for data formats marshalling to XML, or
@@ -95,6 +100,14 @@ public class BindyFixedLengthDataFormatConfiguration
this.unwrapSingleInstance = unwrapSingleInstance;
}
+ public Boolean getAllowEmptyStream() {
+ return allowEmptyStream;
+ }
+
+ public void setAllowEmptyStream(Boolean allowEmptyStream) {
+ this.allowEmptyStream = allowEmptyStream;
+ }
+
public Boolean getContentTypeHeader() {
return contentTypeHeader;
}
diff --git
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatConfiguration.java
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatConfiguration.java
index a3392ed..00f8f1e 100644
---
a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatConfiguration.java
+++
b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatConfiguration.java
@@ -56,6 +56,11 @@ public class BindyKeyValuePairDataFormatConfiguration
*/
private Boolean unwrapSingleInstance = true;
/**
+ * Whether to allow empty streams in the unmarshal process. If true, no
+ * exception will be thrown when a body without records is provided.
+ */
+ private Boolean allowEmptyStream = false;
+ /**
* Whether the data format should set the Content-Type header with the type
* from the data format if the data format is capable of doing so. For
* example application/xml for data formats marshalling to XML, or
@@ -95,6 +100,14 @@ public class BindyKeyValuePairDataFormatConfiguration
this.unwrapSingleInstance = unwrapSingleInstance;
}
+ public Boolean getAllowEmptyStream() {
+ return allowEmptyStream;
+ }
+
+ public void setAllowEmptyStream(Boolean allowEmptyStream) {
+ this.allowEmptyStream = allowEmptyStream;
+ }
+
public Boolean getContentTypeHeader() {
return contentTypeHeader;
}