This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-13755 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 91e25ea51113a0d659d8012a11507561c954297c Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Jul 21 12:40:43 2019 +0200 CAMEL-13755: camel3 - Remove fault from camel-core/message and let it be component specific for camel-cxf and camel-spring-ws as its only used by SOAP-WS --- .../src/main/docs/activemq-component.adoc | 9 +- .../camel-amqp/src/main/docs/amqp-component.adoc | 9 +- .../apache/camel/component/cxf/CxfConsumer.java | 7 +- .../camel/component/cxf/CxfConsumerFaultTest.java | 1 - .../cxf/CxfConsumerPayLoadFaultMessageTest.java | 1 - .../cxf/CxfConsumerPayLoadMarshalFaultTest.java | 1 - .../component/cxf/CxfCustomizedExceptionTest.java | 2 - .../cxf/CxfMessageStreamExceptionTest.java | 1 - .../cxf/CxfSpringCustomizedExceptionTest.java | 1 - .../component/cxf/jaxrs/CxfRsConsumerTest.java | 2 - .../apache/camel/non_wrapper/PersonProcessor.java | 3 - .../apache/camel/wsdl_first/PersonProcessor.java | 3 - .../camel-jms/src/main/docs/jms-component.adoc | 4 +- .../netty4/http/NettyHttpReturnFaultTest.java | 58 ---------- .../cinder/producer/SnapshotProducer.java | 4 +- .../openstack/cinder/producer/VolumeProducer.java | 4 +- .../common/AbstractOpenstackProducer.java | 5 +- .../openstack/common/OpenstackException.java | 26 +++++ .../common/OpenstackOperationException.java | 43 ++++++++ .../component/openstack/glance/GlanceProducer.java | 2 +- .../keystone/producer/DomainProducer.java | 2 +- .../openstack/keystone/producer/GroupProducer.java | 6 +- .../keystone/producer/ProjectProducer.java | 2 +- .../keystone/producer/RegionProducer.java | 2 +- .../openstack/keystone/producer/UserProducer.java | 2 +- .../neutron/producer/NetworkProducer.java | 2 +- .../openstack/neutron/producer/PortProducer.java | 2 +- .../openstack/neutron/producer/RouterProducer.java | 2 +- .../openstack/neutron/producer/SubnetProducer.java | 2 +- .../openstack/nova/producer/FlavorsProducer.java | 2 +- .../openstack/nova/producer/KeypairProducer.java | 2 +- .../openstack/nova/producer/ServerProducer.java | 4 +- .../swift/producer/ContainerProducer.java | 13 ++- .../openstack/swift/producer/ObjectProducer.java | 7 +- .../openstack/cinder/VolumeProducerTest.java | 7 +- .../cinder/VolumeSnapshotProducerTest.java | 2 - .../openstack/keystone/DomainProducerTest.java | 5 +- .../openstack/keystone/GroupProducerTest.java | 5 +- .../openstack/keystone/ProjectProducerTest.java | 5 +- .../openstack/keystone/RegionProducerTest.java | 5 +- .../openstack/keystone/UserProducerTest.java | 5 +- .../openstack/neutron/NetworkProducerTest.java | 5 +- .../openstack/neutron/PortProducerTest.java | 5 +- .../openstack/neutron/RouterProducerTest.java | 5 +- .../openstack/neutron/SubnetProducerTest.java | 5 +- .../openstack/nova/FlavorProducerTest.java | 5 +- .../openstack/nova/ServerProducerTest.java | 5 +- .../openstack/swift/ContainerProducerTest.java | 9 +- .../openstack/swift/ObjectProducerTest.java | 8 +- .../component/restlet/DefaultRestletBinding.java | 18 ++-- .../apache/camel/component/sjms/SjmsMessage.java | 1 - .../sjms/tx/TransactedConsumerSupport.java | 2 +- .../sjms/tx/TransactedQueueProducerTest.java | 4 +- .../sjms/tx/TransactedTopicProducerTest.java | 2 +- .../integration/adapter/CamelTargetAdapter.java | 4 - core/camel-core/readme-eip.adoc | 5 +- .../endpoint/dsl/AMQPEndpointBuilderFactory.java | 118 -------------------- .../dsl/ActiveMQEndpointBuilderFactory.java | 120 --------------------- .../springboot/ActiveMQComponentConfiguration.java | 19 ---- .../springboot/AMQPComponentConfiguration.java | 19 ---- .../camel/itest/greeter/JmsPrepareResponse.java | 4 +- 61 files changed, 149 insertions(+), 484 deletions(-) diff --git a/components/camel-activemq/src/main/docs/activemq-component.adoc b/components/camel-activemq/src/main/docs/activemq-component.adoc index 4faf25f..13784cb 100644 --- a/components/camel-activemq/src/main/docs/activemq-component.adoc +++ b/components/camel-activemq/src/main/docs/activemq-component.adoc @@ -44,7 +44,7 @@ activemq:foo === Component options // component options: START -The ActiveMQ component supports 86 options, which are listed below. +The ActiveMQ component supports 85 options, which are listed below. @@ -112,7 +112,6 @@ The ActiveMQ component supports 86 options, which are listed below. | *requestTimeoutChecker Interval* (advanced) | Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs, then you can lower this interval, to check more frequently. The timeout is determined by the option requestTimeout. | 1000 | long | *transferExchange* (advanced) | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the payloads is an E [...] | *transferException* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option takes preced [...] -| *transferFault* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel components [...] | *jmsOperations* (advanced) | Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface. Camel uses JmsTemplate as default. Can be used for testing purpose, but not used much as stated in the spring API docs. | | JmsOperations | *destinationResolver* (advanced) | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example, to lookup the real destination in a JNDI registry). | | DestinationResolver | *replyToType* (producer) | Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary, Shared, or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured, then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details, and especially the notes about the implications if running [...] @@ -163,7 +162,7 @@ with the following path and query parameters: |=== -==== Query Parameters (93 parameters): +==== Query Parameters (92 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -249,7 +248,6 @@ with the following path and query parameters: | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean | *transferException* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option takes preced [...] | *transferExchange* (advanced) | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the payloads is an E [...] -| *transferFault* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel components [...] | *useMessageIDAsCorrelation ID* (advanced) | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | boolean | *waitForProvisionCorrelation ToBeUpdatedCounter* (advanced) | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | 50 | int | *waitForProvisionCorrelation ToBeUpdatedThreadSleeping Time* (advanced) | Interval in millis to sleep each time while waiting for provisional correlation id to be updated. | 100 | long @@ -281,7 +279,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s ---- -The component supports 87 options, which are listed below. +The component supports 86 options, which are listed below. @@ -367,7 +365,6 @@ The component supports 87 options, which are listed below. | *camel.component.activemq.transaction-timeout* | The timeout value of the transaction (in seconds), if using transacted mode. | -1 | Integer | *camel.component.activemq.transfer-exception* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this opti [...] | *camel.component.activemq.transfer-exchange* | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the p [...] -| *camel.component.activemq.transfer-fault* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Ca [...] | *camel.component.activemq.trust-all-packages* | Define if all packages are trusted or not | false | Boolean | *camel.component.activemq.use-message-i-d-as-correlation-i-d* | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | Boolean | *camel.component.activemq.use-pooled-connection* | Enables or disables whether a PooledConnectionFactory will be used so that when messages are sent to ActiveMQ from outside of a message consuming thread, pooling will be used rather than the default with the Spring JmsTemplate which will create a new connection, session, producer for each message then close them all down again. The default value is true. Note that this requires an extra dependency on commons-pool2. | false | Boolean diff --git a/components/camel-amqp/src/main/docs/amqp-component.adoc b/components/camel-amqp/src/main/docs/amqp-component.adoc index 5994810..23675ad 100644 --- a/components/camel-amqp/src/main/docs/amqp-component.adoc +++ b/components/camel-amqp/src/main/docs/amqp-component.adoc @@ -36,7 +36,7 @@ xref:../../../../camel-jms/src/main/docs/readme.adoc[JMS] component after the de // component options: START -The AMQP component supports 81 options, which are listed below. +The AMQP component supports 80 options, which are listed below. @@ -99,7 +99,6 @@ The AMQP component supports 81 options, which are listed below. | *requestTimeoutChecker Interval* (advanced) | Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs, then you can lower this interval, to check more frequently. The timeout is determined by the option requestTimeout. | 1000 | long | *transferExchange* (advanced) | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the payloads is an E [...] | *transferException* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option takes preced [...] -| *transferFault* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel components [...] | *jmsOperations* (advanced) | Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface. Camel uses JmsTemplate as default. Can be used for testing purpose, but not used much as stated in the spring API docs. | | JmsOperations | *destinationResolver* (advanced) | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example, to lookup the real destination in a JNDI registry). | | DestinationResolver | *replyToType* (producer) | Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary, Shared, or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured, then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details, and especially the notes about the implications if running [...] @@ -153,7 +152,7 @@ with the following path and query parameters: |=== -==== Query Parameters (93 parameters): +==== Query Parameters (92 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -239,7 +238,6 @@ with the following path and query parameters: | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean | *transferException* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option takes preced [...] | *transferExchange* (advanced) | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the payloads is an E [...] -| *transferFault* (advanced) | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel components [...] | *useMessageIDAsCorrelation ID* (advanced) | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | boolean | *waitForProvisionCorrelation ToBeUpdatedCounter* (advanced) | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | 50 | int | *waitForProvisionCorrelation ToBeUpdatedThreadSleeping Time* (advanced) | Interval in millis to sleep each time while waiting for provisional correlation id to be updated. | 100 | long @@ -270,7 +268,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s ---- -The component supports 82 options, which are listed below. +The component supports 81 options, which are listed below. @@ -354,7 +352,6 @@ The component supports 82 options, which are listed below. | *camel.component.amqp.transaction-timeout* | The timeout value of the transaction (in seconds), if using transacted mode. | -1 | Integer | *camel.component.amqp.transfer-exception* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option t [...] | *camel.component.amqp.transfer-exchange* | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the paylo [...] -| *camel.component.amqp.transfer-fault* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel [...] | *camel.component.amqp.use-message-i-d-as-correlation-i-d* | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | Boolean | *camel.component.amqp.username* | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | | String | *camel.component.amqp.wait-for-provision-correlation-to-be-updated-counter* | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | 50 | Integer diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java index 9381557..cad4692 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java @@ -327,12 +327,7 @@ public class CxfConsumer extends DefaultConsumer implements Suspendable { private void checkFailure(org.apache.camel.Exchange camelExchange, Exchange cxfExchange) throws Fault { final Throwable t; if (camelExchange.isFailed()) { - org.apache.camel.Message camelMsg = camelExchange.hasOut() ? camelExchange.getOut() : camelExchange.getIn(); - if (camelMsg.isFault()) { - t = camelMsg.getBody(Throwable.class); - } else { - t = camelExchange.getException(); - } + t = camelExchange.getException(); cxfExchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); if (t instanceof Fault) { cxfExchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerFaultTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerFaultTest.java index 24f36aa..652b01b 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerFaultTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerFaultTest.java @@ -40,7 +40,6 @@ public class CxfConsumerFaultTest extends CxfConsumerPayloadFaultTest { faultDetail.setPersonId(""); UnknownPersonFault fault = new UnknownPersonFault("Get the null value of person name", faultDetail); exchange.getOut().setBody(fault); - exchange.getOut().setFault(true); } }); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadFaultMessageTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadFaultMessageTest.java index e18de13..73c2bc7 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadFaultMessageTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadFaultMessageTest.java @@ -46,7 +46,6 @@ public class CxfConsumerPayLoadFaultMessageTest extends CxfConsumerPayloadFaultT outElements.add(details); CxfPayload<SoapHeader> responsePayload = new CxfPayload<>(null, outElements); exchange.getOut().setBody(responsePayload); - exchange.getOut().setFault(true); } }); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadMarshalFaultTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadMarshalFaultTest.java index e843b44..477e401 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadMarshalFaultTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayLoadMarshalFaultTest.java @@ -51,7 +51,6 @@ public class CxfConsumerPayLoadMarshalFaultTest extends CxfConsumerPayloadFaultT context.createMarshaller().marshal(unknowPersonFault, details); fault.setDetail(details); exchange.getOut().setBody(fault); - exchange.getOut().setFault(true); } }); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java index 8bb9a66..a883375 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java @@ -101,7 +101,6 @@ public class CxfCustomizedExceptionTest extends CamelTestSupport { public void process(Exchange exchange) throws Exception { SoapFault fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, SoapFault.class); - exchange.getOut().setFault(true); exchange.getOut().setBody(fault); } @@ -113,7 +112,6 @@ public class CxfCustomizedExceptionTest extends CamelTestSupport { from(routerEndpointURI).process(new Processor() { @Override public void process(Exchange exchange) throws Exception { - exchange.getMessage().setFault(true); exchange.getMessage().setBody(SOAP_FAULT); } }); diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMessageStreamExceptionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMessageStreamExceptionTest.java index bba1c7b..afd5b91 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMessageStreamExceptionTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfMessageStreamExceptionTest.java @@ -33,7 +33,6 @@ public class CxfMessageStreamExceptionTest extends CxfMessageCustomizedException public void process(Exchange exchange) throws Exception { SoapFault fault = exchange .getProperty(Exchange.EXCEPTION_CAUGHT, SoapFault.class); - exchange.getOut().setFault(true); exchange.getOut().setBody(fault); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java index b00300a..8a84359 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java @@ -100,7 +100,6 @@ public class CxfSpringCustomizedExceptionTest extends CamelTestSupport { @Override public void process(Exchange exchange) throws Exception { - exchange.getMessage().setFault(true); exchange.getMessage().setBody(SOAP_FAULT); } } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java index 317d924..af5b9b5 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java @@ -255,12 +255,10 @@ public class CxfRsConsumerTest extends CamelTestSupport { Response r = Response.status(404).entity("Can't found the customer with uri " + path) .header("Content-Type", "text/plain").build(); exchange.getOut().setBody(r); - exchange.getOut().setFault(true); } else if ("/customerservice/customers/789".equals(path)) { exchange.getOut().setBody("Can't found the customer with uri " + path); exchange.getOut().setHeader(Exchange.CONTENT_TYPE, "text/plain"); exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, "404"); - exchange.getOut().setFault(true); } else { throw new RuntimeCamelException("Can't found the customer with uri " + path); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/non_wrapper/PersonProcessor.java b/components/camel-cxf/src/test/java/org/apache/camel/non_wrapper/PersonProcessor.java index 579ca11..eefff51 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/non_wrapper/PersonProcessor.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/non_wrapper/PersonProcessor.java @@ -49,9 +49,6 @@ public class PersonProcessor implements Processor { personFault.setPersonId(""); org.apache.camel.non_wrapper.UnknownPersonFault fault = new org.apache.camel.non_wrapper.UnknownPersonFault("Get the null value of person name", personFault); - // Since camel has its own exception handler framework, we can't throw the exception to trigger it - // We just set the fault message in the exchange for camel-cxf component handling and return - exchange.getOut().setFault(true); exchange.getOut().setBody(fault); return; } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java b/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java index 9bd5fcf..f8a77d9 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java @@ -52,9 +52,6 @@ public class PersonProcessor implements Processor { personFault.setPersonId(""); org.apache.camel.wsdl_first.UnknownPersonFault fault = new org.apache.camel.wsdl_first.UnknownPersonFault("Get the null value of person name", personFault); - // Since camel has its own exception handler framework, we can't throw the exception to trigger it - // We just set the fault message in the exchange for camel-cxf component handling and return - exchange.getOut().setFault(true); exchange.getOut().setBody(fault); return; } diff --git a/components/camel-jms/src/main/docs/jms-component.adoc b/components/camel-jms/src/main/docs/jms-component.adoc index 8e9e1ae..3e0b64f 100644 --- a/components/camel-jms/src/main/docs/jms-component.adoc +++ b/components/camel-jms/src/main/docs/jms-component.adoc @@ -435,7 +435,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s ---- -The component supports 171 options, which are listed below. +The component supports 169 options, which are listed below. @@ -543,7 +543,6 @@ The component supports 171 options, which are listed below. | *camel.component.jms.configuration.transaction-timeout* | The timeout value of the transaction (in seconds), if using transacted mode. | -1 | Integer | *camel.component.jms.configuration.transfer-exception* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, [...] | *camel.component.jms.configuration.transfer-exchange* | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel kn [...] -| *camel.component.jms.configuration.transfer-fault* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on {@link org.apache.camel.Message#isFault()} will be send back in the response as a JMS header with the key {@link JmsConstants#JMS_TRANSFER_FAULT}. If the client is Camel, the returned fault flag will be set on the {@link org.apache.camel.Message#setFault(boolean)}. <p> You [...] | *camel.component.jms.configuration.use-message-i-d-as-correlation-i-d* | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | Boolean | *camel.component.jms.configuration.username* | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | | String | *camel.component.jms.configuration.wait-for-provision-correlation-to-be-updated-counter* | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | 50 | Integer @@ -608,7 +607,6 @@ The component supports 171 options, which are listed below. | *camel.component.jms.transaction-timeout* | The timeout value of the transaction (in seconds), if using transacted mode. | -1 | Integer | *camel.component.jms.transfer-exception* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side, then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel, the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example, using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled, this option ta [...] | *camel.component.jms.transfer-exchange* | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body, Out body, Fault body, In headers, Out headers, Fault headers, exchange properties, exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side, so Camel knows the payloa [...] -| *camel.component.jms.transfer-fault* | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side, then the fault flag on org.apache.camel.Message#isFault() will be send back in the response as a JMS header with the key JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned fault flag will be set on the org.apache.camel.Message#setFault(boolean). You may want to enable this when using Camel c [...] | *camel.component.jms.use-message-i-d-as-correlation-i-d* | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | false | Boolean | *camel.component.jms.username* | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | | String | *camel.component.jms.wait-for-provision-correlation-to-be-updated-counter* | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | 50 | Integer diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpReturnFaultTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpReturnFaultTest.java deleted file mode 100644 index 27f5fb9..0000000 --- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpReturnFaultTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.component.netty4.http; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.junit.Test; - -public class NettyHttpReturnFaultTest extends BaseNettyTest { - - @Test - public void testHttpFault() throws Exception { - Exchange exchange = template.request("netty4-http:http://localhost:{{port}}/test", new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - exchange.getIn().setBody("Hello World!"); - } - - }); - assertTrue(exchange.isFailed()); - NettyHttpOperationFailedException exception = exchange.getException(NettyHttpOperationFailedException.class); - assertNotNull(exception); - assertEquals(500, exception.getStatusCode()); - String message = exception.getContentAsString(); - assertEquals("This is a fault", message); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("netty4-http:http://localhost:{{port}}/test") - .process(new Processor() { - public void process(Exchange exchange) throws Exception { - exchange.getOut().setFault(true); - exchange.getOut().setBody("This is a fault"); - } - }); - } - }; - } -} diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/SnapshotProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/SnapshotProducer.java index 02b5ae3..e236e39 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/SnapshotProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/SnapshotProducer.java @@ -90,7 +90,7 @@ public class SnapshotProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(id, "Cinder Snapshot ID"); final ActionResponse out = os.blockStorage().snapshots().update(id, vs.getName(), vs.getDescription()); - checkFailure(out, msg, "Update volume snapshot " + id); + checkFailure(out, exchange, "Update volume snapshot " + id); } private void doDelete(Exchange exchange) { @@ -99,7 +99,7 @@ public class SnapshotProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(id, "Cinder Snapshot ID"); final ActionResponse out = os.blockStorage().snapshots().delete(id); - checkFailure(out, msg, "Delete snapshot " + id); + checkFailure(out, exchange, "Delete snapshot " + id); } private VolumeSnapshot messageToSnapshot(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/VolumeProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/VolumeProducer.java index bc6b961..37d7f04 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/VolumeProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/cinder/producer/VolumeProducer.java @@ -100,7 +100,7 @@ public class VolumeProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(vol.getDescription(), "Cinder Volume Description"); StringHelper.notEmpty(vol.getName(), "Cinder Volume Name"); final ActionResponse out = os.blockStorage().volumes().update(id, vol.getName(), vol.getDescription()); - checkFailure(out, msg, "Update volume " + id); + checkFailure(out, exchange, "Update volume " + id); } private void doDelete(Exchange exchange) { @@ -108,7 +108,7 @@ public class VolumeProducer extends AbstractOpenstackProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.VOLUME_ID, String.class), String.class); StringHelper.notEmpty(id, "Cinder Volume ID"); final ActionResponse out = os.blockStorage().volumes().delete(id); - checkFailure(out, msg, "Delete volume " + id); + checkFailure(out, exchange, "Delete volume " + id); } private Volume messageToVolume(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/AbstractOpenstackProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/AbstractOpenstackProducer.java index 96bec2f..9d424e7 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/AbstractOpenstackProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/AbstractOpenstackProducer.java @@ -73,10 +73,9 @@ public abstract class AbstractOpenstackProducer extends DefaultProducer { return operation; } - protected void checkFailure(ActionResponse response, Message msg, String operation) { - msg.setFault(!response.isSuccess()); + protected void checkFailure(ActionResponse response, Exchange exchange, String operation) { if (!response.isSuccess()) { - msg.setBody(String.format(" %s was not successful: %s", operation, response.getFault())); + exchange.setException(new OpenstackOperationException(operation, response.getFault(), response.getCode())); } } } diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackException.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackException.java new file mode 100644 index 0000000..6466dff --- /dev/null +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackException.java @@ -0,0 +1,26 @@ +/* + * 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.component.openstack.common; + +import org.apache.camel.Exchange; + +public class OpenstackException extends Exception { + + public OpenstackException(String message) { + super(message); + } +} diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackOperationException.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackOperationException.java new file mode 100644 index 0000000..5a0e86f --- /dev/null +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/common/OpenstackOperationException.java @@ -0,0 +1,43 @@ +/* + * 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.component.openstack.common; + +public class OpenstackOperationException extends OpenstackException { + + private String operation; + private String fault; + private int code; + + public OpenstackOperationException(String operation, String fault, int code) { + super(String.format("%s was not successful: %s (%s)", operation, fault, code)); + this.operation = operation; + this.fault = fault; + this.code = code; + } + + public String getOperation() { + return operation; + } + + public String getFault() { + return fault; + } + + public int getCode() { + return code; + } +} diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/glance/GlanceProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/glance/GlanceProducer.java index bf5be4dc..0a86f0d 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/glance/GlanceProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/glance/GlanceProducer.java @@ -120,7 +120,7 @@ public class GlanceProducer extends AbstractOpenstackProducer { final String imageId = msg.getHeader(OpenstackConstants.ID, String.class); StringHelper.notEmpty(imageId, "ImageID"); final ActionResponse response = os.compute().images().delete(imageId); - checkFailure(response, msg, "Delete image " + imageId); + checkFailure(response, exchange, "Delete image " + imageId); } private Image messageToImage(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/DomainProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/DomainProducer.java index 5c49056..638c9af 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/DomainProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/DomainProducer.java @@ -92,7 +92,7 @@ public class DomainProducer extends AbstractKeystoneProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.DOMAIN_ID, String.class), String.class); StringHelper.notEmpty(id, "Domain ID"); final ActionResponse response = osV3Client.identity().domains().delete(id); - checkFailure(response, msg, "Delete domain" + id); + checkFailure(response, exchange, "Delete domain" + id); } private Domain messageToDomain(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/GroupProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/GroupProducer.java index 276225a..d56f6b7 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/GroupProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/GroupProducer.java @@ -101,7 +101,7 @@ public class GroupProducer extends AbstractKeystoneProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.GROUP_ID, String.class), String.class); StringHelper.notEmpty(id, "Group ID"); final ActionResponse response = osV3Client.identity().groups().delete(id); - checkFailure(response, msg, "Delete group with ID " + id); + checkFailure(response, exchange, "Delete group with ID " + id); } private void doAddUser(Exchange exchange) { @@ -111,7 +111,7 @@ public class GroupProducer extends AbstractKeystoneProducer { StringHelper.notEmpty(userId, "User ID"); StringHelper.notEmpty(groupId, "Group ID"); final ActionResponse response = osV3Client.identity().groups().addUserToGroup(groupId, userId); - checkFailure(response, msg, String.format("Add user %s to group %s", userId, groupId)); + checkFailure(response, exchange, String.format("Add user %s to group %s", userId, groupId)); } private void doCheckUserGroup(Exchange exchange) { @@ -131,7 +131,7 @@ public class GroupProducer extends AbstractKeystoneProducer { StringHelper.notEmpty(userId, "User ID"); StringHelper.notEmpty(groupId, "Group ID"); final ActionResponse response = osV3Client.identity().groups().removeUserFromGroup(groupId, userId); - checkFailure(response, msg, String.format("Delete user %s from group %s", userId, groupId)); + checkFailure(response, exchange, String.format("Delete user %s from group %s", userId, groupId)); } private Group messageToGroup(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/ProjectProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/ProjectProducer.java index c00ac8e..323d057 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/ProjectProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/ProjectProducer.java @@ -92,7 +92,7 @@ public class ProjectProducer extends AbstractKeystoneProducer { final String id = msg.getHeader(OpenstackConstants.ID, String.class); StringHelper.notEmpty(id, "Project ID"); final ActionResponse response = osV3Client.identity().projects().delete(id); - checkFailure(response, msg, "Delete project with ID " + id); + checkFailure(response, exchange, "Delete project with ID " + id); } private Project messageToProject(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/RegionProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/RegionProducer.java index 0d1008b..e9a57cd 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/RegionProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/RegionProducer.java @@ -91,7 +91,7 @@ public class RegionProducer extends AbstractKeystoneProducer { final String id = msg.getHeader(OpenstackConstants.ID, String.class); StringHelper.notEmpty(id, "Region ID"); final ActionResponse response = osV3Client.identity().regions().delete(id); - checkFailure(response, msg, "Delete network" + id); + checkFailure(response, exchange, "Delete network" + id); } private Region messageToRegion(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/UserProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/UserProducer.java index c41dfb5..c4ba85c 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/UserProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/keystone/producer/UserProducer.java @@ -92,7 +92,7 @@ public class UserProducer extends AbstractKeystoneProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(KeystoneConstants.USER_ID, String.class), String.class); StringHelper.notEmpty(id, "User ID"); final ActionResponse response = osV3Client.identity().users().delete(id); - checkFailure(response, msg, "Delete user with ID " + id); + checkFailure(response, exchange, "Delete user with ID " + id); } private User messageToUser(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/NetworkProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/NetworkProducer.java index 320e957..185dca8 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/NetworkProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/NetworkProducer.java @@ -84,7 +84,7 @@ public class NetworkProducer extends AbstractOpenstackProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.NETWORK_ID, String.class), String.class); StringHelper.notEmpty(id, "Network ID"); final ActionResponse response = os.networking().network().delete(id); - checkFailure(response, msg, "Delete network" + id); + checkFailure(response, exchange, "Delete network" + id); } private Network messageToNetwork(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/PortProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/PortProducer.java index 3abd2fa..797ee26 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/PortProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/PortProducer.java @@ -93,7 +93,7 @@ public class PortProducer extends AbstractOpenstackProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.PORT_ID, String.class), String.class); StringHelper.notEmpty(id, "Port ID"); final ActionResponse response = os.networking().port().delete(id); - checkFailure(response, msg, "Delete port with ID " + id); + checkFailure(response, exchange, "Delete port with ID " + id); } private Port messageToPort(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/RouterProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/RouterProducer.java index 9d4e372..060b335 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/RouterProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/RouterProducer.java @@ -102,7 +102,7 @@ public class RouterProducer extends AbstractOpenstackProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.ROUTER_ID, String.class), String.class); StringHelper.notEmpty(id, "Router ID"); final ActionResponse response = os.networking().router().delete(id); - checkFailure(response, msg, "Delete router with ID " + id); + checkFailure(response, exchange, "Delete router with ID " + id); } private void doDetach(Exchange exchange) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/SubnetProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/SubnetProducer.java index c4a602f..6b753ee 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/SubnetProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/neutron/producer/SubnetProducer.java @@ -86,7 +86,7 @@ public class SubnetProducer extends AbstractOpenstackProducer { final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.SUBNET_ID, String.class), String.class); StringHelper.notEmpty(id, "Subnet ID"); final ActionResponse response = os.networking().subnet().delete(id); - checkFailure(response, msg, "Delete network " + id); + checkFailure(response, exchange, "Delete network " + id); } diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/FlavorsProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/FlavorsProducer.java index 89dc344..8478f04 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/FlavorsProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/FlavorsProducer.java @@ -83,7 +83,7 @@ public class FlavorsProducer extends AbstractOpenstackProducer { final String flavorId = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NovaConstants.FLAVOR_ID, String.class), String.class); StringHelper.notEmpty(flavorId, "FlavorID"); final ActionResponse response = os.compute().flavors().delete(flavorId); - checkFailure(response, msg, "Delete flavor"); + checkFailure(response, exchange, "Delete flavor"); } private org.openstack4j.model.compute.Flavor messageToFlavor(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/KeypairProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/KeypairProducer.java index 908cf0f..0550efd 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/KeypairProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/KeypairProducer.java @@ -84,7 +84,7 @@ public class KeypairProducer extends AbstractOpenstackProducer { final String keypairName = msg.getHeader(OpenstackConstants.NAME, String.class); StringHelper.notEmpty(keypairName, "Keypair name"); final ActionResponse response = os.compute().keypairs().delete(keypairName); - checkFailure(response, msg, "Delete keypair " + keypairName); + checkFailure(response, exchange, "Delete keypair " + keypairName); } } diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/ServerProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/ServerProducer.java index c5d54b2..c137ff5 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/ServerProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/nova/producer/ServerProducer.java @@ -111,7 +111,7 @@ public class ServerProducer extends AbstractOpenstackProducer { ObjectHelper.notNull(action, "Server action"); StringHelper.notEmpty(serverId, "Server ID"); final ActionResponse response = os.compute().servers().action(serverId, action); - checkFailure(response, msg, "Performing action " + action.name()); + checkFailure(response, exchange, "Performing action " + action.name()); } private void doDelete(Exchange exchange) { @@ -119,7 +119,7 @@ public class ServerProducer extends AbstractOpenstackProducer { final String serverId = msg.getHeader(OpenstackConstants.ID, String.class); StringHelper.notEmpty(serverId, "Server ID"); final ActionResponse response = os.compute().servers().delete(serverId); - checkFailure(response, msg, "Delete server with ID " + serverId); + checkFailure(response, exchange, "Delete server with ID " + serverId); } private ServerCreate messageToServer(Message message) { diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ContainerProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ContainerProducer.java index b23ab7e..4845c6b 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ContainerProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ContainerProducer.java @@ -23,6 +23,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.openstack.common.AbstractOpenstackProducer; import org.apache.camel.component.openstack.common.OpenstackConstants; +import org.apache.camel.component.openstack.common.OpenstackException; import org.apache.camel.component.openstack.swift.SwiftConstants; import org.apache.camel.component.openstack.swift.SwiftEndpoint; import org.apache.camel.util.StringHelper; @@ -80,7 +81,7 @@ public class ContainerProducer extends AbstractOpenstackProducer { final CreateUpdateContainerOptions options = messageToCreateUpdateOptions(msg); final ActionResponse out = os.objectStorage().containers().create(name, options); - checkFailure(out, msg, "Create container " + name); + checkFailure(out, exchange, "Create container " + name); } private void doGet(Exchange exchange) { @@ -102,7 +103,7 @@ public class ContainerProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(name, "Container name"); final CreateUpdateContainerOptions options = messageToCreateUpdateOptions(msg); final ActionResponse out = os.objectStorage().containers().update(name, options); - checkFailure(out, msg, "Update container " + name); + checkFailure(out, exchange, "Update container " + name); } private void doDelete(Exchange exchange) { @@ -110,7 +111,7 @@ public class ContainerProducer extends AbstractOpenstackProducer { final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class); StringHelper.notEmpty(name, "Container name"); final ActionResponse out = os.objectStorage().containers().delete(name); - checkFailure(out, msg, "Delete container " + name); + checkFailure(out, exchange, "Delete container " + name); } private void doGetMetadata(Exchange exchange) { @@ -125,9 +126,8 @@ public class ContainerProducer extends AbstractOpenstackProducer { final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class); StringHelper.notEmpty(name, "Container name"); boolean success = os.objectStorage().containers().deleteMetadata(name, msg.getBody(Map.class)); - msg.setFault(!success); if (!success) { - msg.setBody("Removing metadata was not successful"); + exchange.setException(new OpenstackException("Removing metadata was not successful")); } } @@ -136,9 +136,8 @@ public class ContainerProducer extends AbstractOpenstackProducer { final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class); StringHelper.notEmpty(name, "Container name"); boolean success = os.objectStorage().containers().updateMetadata(name, msg.getBody(Map.class)); - msg.setFault(!success); if (!success) { - msg.setBody("Updating metadata was not successful"); + exchange.setException(new OpenstackException("Updating metadata was not successful")); } } diff --git a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ObjectProducer.java b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ObjectProducer.java index 411db32..562c6eb 100644 --- a/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ObjectProducer.java +++ b/components/camel-openstack/src/main/java/org/apache/camel/component/openstack/swift/producer/ObjectProducer.java @@ -23,6 +23,7 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.openstack.common.AbstractOpenstackProducer; import org.apache.camel.component.openstack.common.OpenstackConstants; +import org.apache.camel.component.openstack.common.OpenstackException; import org.apache.camel.component.openstack.swift.SwiftConstants; import org.apache.camel.component.openstack.swift.SwiftEndpoint; import org.apache.camel.util.StringHelper; @@ -102,8 +103,7 @@ public class ObjectProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(containerName, "Container name"); StringHelper.notEmpty(objectName, "Object name"); final ActionResponse out = os.objectStorage().objects().delete(containerName, objectName); - msg.setBody(out.getFault()); - msg.setFault(!out.isSuccess()); + checkFailure(out, exchange, "Delete container"); } private void doGetMetadata(Exchange exchange) { @@ -123,9 +123,8 @@ public class ObjectProducer extends AbstractOpenstackProducer { StringHelper.notEmpty(containerName, "Container name"); StringHelper.notEmpty(objectName, "Object name"); final boolean success = os.objectStorage().objects().updateMetadata(ObjectLocation.create(containerName, objectName), msg.getBody(Map.class)); - msg.setFault(!success); if (!success) { - msg.setBody("Updating metadata was not successful"); + exchange.setException(new OpenstackException("Updating metadata was not successful")); } } } diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java index 8a822e1..adff34a 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeProducerTest.java @@ -110,7 +110,6 @@ public class VolumeProducerTest extends CinderProducerTestSupport { assertEquals(id, idCaptor.getValue()); assertEquals(name, nameCaptor.getValue()); assertEquals(desc, descCaptor.getValue()); - assertFalse(msg.isFault()); assertNull(msg.getBody()); } @@ -126,8 +125,8 @@ public class VolumeProducerTest extends CinderProducerTestSupport { producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(faultMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(faultMessage)); } @Test @@ -150,8 +149,6 @@ public class VolumeProducerTest extends CinderProducerTestSupport { verify(volumeService).delete(captor.capture()); assertEquals(id, captor.getValue()); - - assertFalse(msg.isFault()); } private void assertEqualVolumes(Volume old, Volume newVolume) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java index 0cfdd8f..e88e2dc 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/cinder/VolumeSnapshotProducerTest.java @@ -108,7 +108,6 @@ public class VolumeSnapshotProducerTest extends CinderProducerTestSupport { assertEquals(id, idCaptor.getValue()); assertEquals(name, nameCaptor.getValue()); assertEquals(desc, descCaptor.getValue()); - assertFalse(msg.isFault()); assertNull(msg.getBody()); } @@ -133,7 +132,6 @@ public class VolumeSnapshotProducerTest extends CinderProducerTestSupport { verify(snapshotService).delete(captor.capture()); assertEquals(id, captor.getValue()); - assertFalse(msg.isFault()); } private void assertEqualsVolumeSnapshots(VolumeSnapshot old, VolumeSnapshot newVolumeSn) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java index 05cbf0b..2e3b871 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/DomainProducerTest.java @@ -152,14 +152,13 @@ public class DomainProducerTest extends KeystoneProducerTestSupport { verify(domainService).delete(domainIdCaptor.capture()); assertEquals(networkID, domainIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(domainService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private void assertEqualsDomain(Domain old, Domain newDomain) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java index f108386..f8d4ca1 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/GroupProducerTest.java @@ -153,14 +153,13 @@ public class GroupProducerTest extends KeystoneProducerTestSupport { verify(groupService).delete(groupIdCaptor.capture()); assertEquals(networkID, groupIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(groupService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private void assertEqualsGroup(Group old, Group newGroup) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java index cc3267c..00e40c1 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/ProjectProducerTest.java @@ -155,14 +155,13 @@ public class ProjectProducerTest extends KeystoneProducerTestSupport { verify(projectService).delete(projectIdCaptor.capture()); assertEquals(networkID, projectIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(projectService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private void assertEqualsProject(Project old, Project newProject) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java index 2bc3734..3fc8fa0 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/RegionProducerTest.java @@ -149,14 +149,13 @@ public class RegionProducerTest extends KeystoneProducerTestSupport { verify(regionService).delete(regionIdCaptor.capture()); assertEquals(networkID, regionIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(regionService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private void assertEqualsRegion(Region old, Region newRegion) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java index 918c85e..1228f16 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/keystone/UserProducerTest.java @@ -157,14 +157,13 @@ public class UserProducerTest extends KeystoneProducerTestSupport { verify(userService).delete(userIdCaptor.capture()); assertEquals(networkID, userIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(userService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private void assertEqualsUser(User old, User newUser) { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java index b911a6e..32697b0 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/NetworkProducerTest.java @@ -133,14 +133,13 @@ public class NetworkProducerTest extends NeutronProducerTestSupport { verify(networkService).delete(networkIdCaptor.capture()); assertEquals(networkID, networkIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(networkService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private Network createNetwork() { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java index 9d0c46c..0fbe05d 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/PortProducerTest.java @@ -154,14 +154,13 @@ public class PortProducerTest extends NeutronProducerTestSupport { verify(portService).delete(portIdCaptor.capture()); assertEquals(portID, portIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(portService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private Port createPort() { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java index ebf7e77..a950509 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/RouterProducerTest.java @@ -162,14 +162,13 @@ public class RouterProducerTest extends NeutronProducerTestSupport { verify(routerService).delete(routerIdCaptor.capture()); assertEquals(routerID, routerIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(routerService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } @Test diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java index 2f25c3b..eff4fb4 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/neutron/SubnetProducerTest.java @@ -132,14 +132,13 @@ public class SubnetProducerTest extends NeutronProducerTestSupport { verify(subnetService).delete(subnetIdCaptor.capture()); assertEquals(subnetID, subnetIdCaptor.getValue()); - assertFalse(msg.isFault()); //in case of failure final String failureMessage = "fail"; when(subnetService.delete(anyString())).thenReturn(ActionResponse.actionFailed(failureMessage, 404)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failureMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failureMessage)); } private Subnet createSubnet() { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java index d92f3f2..0aa83f5 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/FlavorProducerTest.java @@ -164,7 +164,6 @@ public class FlavorProducerTest extends NovaProducerTestSupport { verify(flavorService).delete(flavorIdCaptor.capture()); assertEquals(id, flavorIdCaptor.getValue()); - assertFalse(msg.isFault()); assertNull(msg.getBody()); } @@ -180,8 +179,8 @@ public class FlavorProducerTest extends NovaProducerTestSupport { verify(flavorService).delete(flavorIdCaptor.capture()); assertEquals(id, flavorIdCaptor.getValue()); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failReason)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failReason)); } private Flavor createTestFlavor() { diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java index 429f315..768b9e0 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/nova/ServerProducerTest.java @@ -120,15 +120,14 @@ public class ServerProducerTest extends NovaProducerTestSupport { assertEquals(id, idArgumentCaptor.getValue()); assertTrue(actionArgumentCaptor.getValue() == Action.PAUSE); - assertFalse(msg.isFault()); assertNull(msg.getBody()); //test fail final String failReason = "fr"; when(serverService.action(anyString(), any())).thenReturn(ActionResponse.actionFailed(failReason, 401)); producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failReason)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failReason)); } @Test diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ContainerProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ContainerProducerTest.java index 34f359a..c9327e6 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ContainerProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ContainerProducerTest.java @@ -91,8 +91,6 @@ public class ContainerProducerTest extends SwiftProducerTestSupport { verify(containerService).create(containerNameCaptor.capture(), optionsCaptor.capture()); assertEquals(CONTAINER_NAME, containerNameCaptor.getValue()); assertNull(optionsCaptor.getValue()); - - assertFalse(msg.isFault()); } @Test @@ -107,7 +105,6 @@ public class ContainerProducerTest extends SwiftProducerTestSupport { verify(containerService).create(containerNameCaptor.capture(), optionsCaptor.capture()); assertEquals(CONTAINER_NAME, containerNameCaptor.getValue()); assertEquals(options, optionsCaptor.getValue()); - assertFalse(msg.isFault()); } @Test @@ -152,8 +149,6 @@ public class ContainerProducerTest extends SwiftProducerTestSupport { verify(containerService).delete(containerNameCaptor.capture()); assertEquals(CONTAINER_NAME, containerNameCaptor.getValue()); - - assertFalse(msg.isFault()); } @Test @@ -165,8 +160,8 @@ public class ContainerProducerTest extends SwiftProducerTestSupport { producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failMessage)); } @Test diff --git a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ObjectProducerTest.java b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ObjectProducerTest.java index d5767c4..2add89d 100644 --- a/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ObjectProducerTest.java +++ b/components/camel-openstack/src/test/java/org/apache/camel/component/openstack/swift/ObjectProducerTest.java @@ -41,7 +41,6 @@ import org.openstack4j.model.storage.object.SwiftObject; import org.openstack4j.model.storage.object.options.ObjectLocation; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; @@ -145,11 +144,8 @@ public class ObjectProducerTest extends SwiftProducerTestSupport { verify(objectService).delete(containerNameCaptor.capture(), objectNameCaptor.capture()); assertEquals(CONTAINER_NAME, containerNameCaptor.getValue()); assertEquals(OBJECT_NAME, objectNameCaptor.getValue()); - - assertFalse(msg.isFault()); } - @Test public void deleteObjectFailTest() throws Exception { final String failMessage = "fail"; @@ -160,8 +156,8 @@ public class ObjectProducerTest extends SwiftProducerTestSupport { producer.process(exchange); - assertTrue(msg.isFault()); - assertTrue(msg.getBody(String.class).contains(failMessage)); + assertTrue(msg.getExchange().isFailed()); + assertTrue(msg.getExchange().getException().getMessage().contains(failMessage)); } @Test diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java index e323b28..dc7e0ec 100644 --- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java +++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java @@ -398,17 +398,13 @@ public class DefaultRestletBinding implements RestletBinding, HeaderFilterStrate // 500 for internal server error which can be overridden by response code in header response.setStatus(Status.valueOf(500)); Message msg = exchange.hasOut() ? exchange.getOut() : exchange.getIn(); - if (msg.isFault()) { - out = msg; - } else { - // print exception as message and stacktrace - Exception t = exchange.getException(); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - response.setEntity(sw.toString(), MediaType.TEXT_PLAIN); - return; - } + // print exception as message and stacktrace + Exception t = exchange.getException(); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + response.setEntity(sw.toString(), MediaType.TEXT_PLAIN); + return; } else { out = exchange.hasOut() ? exchange.getOut() : exchange.getIn(); } diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java index 2d8bc48..548b7c8 100644 --- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java +++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsMessage.java @@ -96,7 +96,6 @@ public class SjmsMessage extends DefaultMessage { // copy body and fault flag setBody(that.getBody()); - setFault(that.isFault()); // we have already cleared the headers if (that.hasHeaders()) { diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java index 620046c..59caa47 100644 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java @@ -109,7 +109,7 @@ public abstract class TransactedConsumerSupport extends CamelTestSupport { public void process(Exchange exchange) throws Exception { if (counter.incrementAndGet() == maxAttemptsCount) { log.info("{} Messages have been processed. Failing the exchange to force a rollback of the transaction.", maxAttemptsCount); - exchange.getOut().setFault(true); + throw new IllegalArgumentException("Forced rollback"); } // Countdown the latch diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedQueueProducerTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedQueueProducerTest.java index bd497a6..0c8257f 100644 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedQueueProducerTest.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedQueueProducerTest.java @@ -87,8 +87,8 @@ public class TransactedQueueProducerTest extends CamelTestSupport { @Override public void process(Exchange exchange) throws Exception { if (exchange.getIn().getHeader("isfailed", Boolean.class)) { - log.info("We failed. Should roll back."); - exchange.getOut().setFault(true); + log.info("We failed. Should roll back."); + throw new IllegalArgumentException("Forced error"); } else { log.info("We passed. Should commit."); } diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedTopicProducerTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedTopicProducerTest.java index 4a7c656..540df18 100644 --- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedTopicProducerTest.java +++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedTopicProducerTest.java @@ -93,7 +93,7 @@ public class TransactedTopicProducerTest extends CamelTestSupport { public void process(Exchange exchange) throws Exception { if (exchange.getIn().getHeader("isfailed", Boolean.class)) { log.info("We failed. Should roll back."); - exchange.getOut().setFault(true); + throw new IllegalArgumentException("Forced error"); } else { log.info("We passed. Should commit."); } diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java index cb04670..2117f1c 100644 --- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java +++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java @@ -71,10 +71,6 @@ public class CamelTargetAdapter extends AbstractCamelAdapter implements MessageH Exchange inExchange = new DefaultExchange(getCamelContext(), pattern); SpringIntegrationBinding.storeToCamelMessage(message, inExchange.getIn()); Exchange outExchange = getCamelTemplate().send(getCamelEndpointUri(), inExchange); - org.apache.camel.Message camelMsg = outExchange.hasOut() ? outExchange.getOut() : outExchange.getIn(); - if (camelMsg.isFault()) { - result = true; - } Message<?> response; if (isExpectReply()) { diff --git a/core/camel-core/readme-eip.adoc b/core/camel-core/readme-eip.adoc index eec89e2..74e6852 100644 --- a/core/camel-core/readme-eip.adoc +++ b/core/camel-core/readme-eip.adoc @@ -3,7 +3,7 @@ Camel supports most of the link:http://www.eaipatterns.com/toc.html[Enterprise Integration Patterns] from the excellent book by link:http://www.amazon.com/exec/obidos/search-handle-url/105-9796798-8100401?%5Fencoding=UTF8&search-type=ss&index=books&field-author=Gregor%20Hohpe[Gregor Hohpe] and link:http://www.amazon.com/exec/obidos/search-handle-url/105-9796798-8100401?%5Fencoding=UTF8&search-type=ss&index=books&field-author=Bobby%20Woolf[Bobby Woolf]. // eips: START -Number of EIPs: 63 (0 deprecated) +Number of EIPs: 62 (0 deprecated) [width="100%",cols="4,6",options="header"] |=== @@ -138,9 +138,6 @@ Number of EIPs: 63 (0 deprecated) | link:src/main/docs/eips/setBody-eip.adoc[Set Body] + `<setBody>` | Sets the contents of the message body -| link:src/main/docs/eips/setFaultBody-eip.adoc[Set Fault Body] + -`<setFaultBody>` | Sets the contents of a fault message's body - | link:src/main/docs/eips/setHeader-eip.adoc[Set Header] + `<setHeader>` | Sets the value of a message header diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java index 87dacfe..fd25f75 100644 --- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java @@ -1828,46 +1828,6 @@ public interface AMQPEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointConsumerBuilder transferFault( - boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointConsumerBuilder transferFault( - String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * @@ -3756,46 +3716,6 @@ public interface AMQPEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointProducerBuilder transferFault( - boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointProducerBuilder transferFault( - String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * @@ -4994,44 +4914,6 @@ public interface AMQPEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointBuilder transferFault(boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedAMQPEndpointBuilder transferFault(String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java index fa120ca..f1c79dd 100644 --- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java @@ -1834,46 +1834,6 @@ public interface ActiveMQEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointConsumerBuilder transferFault( - boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointConsumerBuilder transferFault( - String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * @@ -3768,46 +3728,6 @@ public interface ActiveMQEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointProducerBuilder transferFault( - boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointProducerBuilder transferFault( - String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * @@ -5015,46 +4935,6 @@ public interface ActiveMQEndpointBuilderFactory { return this; } /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option is a: <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointBuilder transferFault( - boolean transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer - * side, then the fault flag on org.apache.camel.Message#isFault() will - * be send back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the - * org.apache.camel.Message#setFault(boolean). You may want to enable - * this when using Camel components that support faults such as SOAP - * based such as cxf or spring-ws. - * - * The option will be converted to a <code>boolean</code> type. - * - * Group: advanced - */ - default AdvancedActiveMQEndpointBuilder transferFault( - String transferFault) { - setProperty("transferFault", transferFault); - return this; - } - /** * Specifies whether JMSMessageID should always be used as * JMSCorrelationID for InOut messages. * diff --git a/platforms/spring-boot/components-starter/camel-activemq-starter/src/main/java/org/apache/camel/component/activemq/springboot/ActiveMQComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-activemq-starter/src/main/java/org/apache/camel/component/activemq/springboot/ActiveMQComponentConfiguration.java index d429554..1206a92 100644 --- a/platforms/spring-boot/components-starter/camel-activemq-starter/src/main/java/org/apache/camel/component/activemq/springboot/ActiveMQComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-activemq-starter/src/main/java/org/apache/camel/component/activemq/springboot/ActiveMQComponentConfiguration.java @@ -445,17 +445,6 @@ public class ActiveMQComponentConfiguration */ private Boolean transferException = false; /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer side, - * then the fault flag on org.apache.camel.Message#isFault() will be send - * back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the org.apache.camel.Message#setFault(boolean). - * You may want to enable this when using Camel components that support - * faults such as SOAP based such as cxf or spring-ws. - */ - private Boolean transferFault = false; - /** * Allows you to use your own implementation of the * org.springframework.jms.core.JmsOperations interface. Camel uses * JmsTemplate as default. Can be used for testing purpose, but not used @@ -1152,14 +1141,6 @@ public class ActiveMQComponentConfiguration this.transferException = transferException; } - public Boolean getTransferFault() { - return transferFault; - } - - public void setTransferFault(Boolean transferFault) { - this.transferFault = transferFault; - } - public String getJmsOperations() { return jmsOperations; } diff --git a/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java index 25c2592..2d7397f 100644 --- a/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentConfiguration.java @@ -411,17 +411,6 @@ public class AMQPComponentConfiguration */ private Boolean transferException = false; /** - * If enabled and you are using Request Reply messaging (InOut) and an - * Exchange failed with a SOAP fault (not exception) on the consumer side, - * then the fault flag on org.apache.camel.Message#isFault() will be send - * back in the response as a JMS header with the key - * JmsConstants#JMS_TRANSFER_FAULT. If the client is Camel, the returned - * fault flag will be set on the org.apache.camel.Message#setFault(boolean). - * You may want to enable this when using Camel components that support - * faults such as SOAP based such as cxf or spring-ws. - */ - private Boolean transferFault = false; - /** * Allows you to use your own implementation of the * org.springframework.jms.core.JmsOperations interface. Camel uses * JmsTemplate as default. Can be used for testing purpose, but not used @@ -1078,14 +1067,6 @@ public class AMQPComponentConfiguration this.transferException = transferException; } - public Boolean getTransferFault() { - return transferFault; - } - - public void setTransferFault(Boolean transferFault) { - this.transferFault = transferFault; - } - public String getJmsOperations() { return jmsOperations; } diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java index 7553e52..e779bbe 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java @@ -35,9 +35,7 @@ public class JmsPrepareResponse implements Processor { FaultDetail faultDetail = new FaultDetail(); faultDetail.setMajor((short)2); faultDetail.setMinor((short)1); - exchange.getOut().setBody(new PingMeFault("PingMeFault raised by server", faultDetail)); - exchange.getOut().setFault(true); - + exchange.getOut().setBody(new PingMeFault("PingMeFault raised by server", faultDetail)); } } }