This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 71666a2 CAMEL-16861: Cleanup and update EIP docs 71666a2 is described below commit 71666a24bc5bf961845a27a0ff7378e9849fa2f1 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Oct 11 17:11:29 2021 +0200 CAMEL-16861: Cleanup and update EIP docs --- .../src/main/java/org/apache/camel/Exchange.java | 4 +- .../docs/modules/eips/pages/removeHeader-eip.adoc | 9 ++- .../docs/modules/eips/pages/removeHeaders-eip.adoc | 11 +++- .../modules/eips/pages/removeProperties-eip.adoc | 72 ++++++++++++++++------ .../modules/eips/pages/removeProperty-eip.adoc | 40 ++++++------ ...http-protocol-headers-in-the-camel-message.adoc | 2 - 6 files changed, 92 insertions(+), 46 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/Exchange.java b/core/camel-api/src/main/java/org/apache/camel/Exchange.java index 3c6639d..5f34c55 100644 --- a/core/camel-api/src/main/java/org/apache/camel/Exchange.java +++ b/core/camel-api/src/main/java/org/apache/camel/Exchange.java @@ -388,7 +388,7 @@ public interface Exchange { Object removeProperty(String name); /** - * Remove all of the properties associated with the exchange matching a specific pattern + * Remove all the properties associated with the exchange matching a specific pattern * * @param pattern pattern of names * @return boolean whether any properties matched @@ -397,7 +397,7 @@ public interface Exchange { /** * Removes the properties from this exchange that match the given <tt>pattern</tt>, except for the ones matching one - * ore more <tt>excludePatterns</tt> + * or more <tt>excludePatterns</tt> * * @param pattern pattern of names that should be removed * @param excludePatterns one or more pattern of properties names that should be excluded (= preserved) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc index b065c0c..81ad38f 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc @@ -5,7 +5,7 @@ :since: :supportlevel: Stable -The Remove Header EIP allows you to remove a header from the xref:message.adoc[Message]. +The Remove Header EIP allows you to remove a single header from the xref:message.adoc[Message]. == Options @@ -37,4 +37,9 @@ And in XML: == See Also -If you need to remove multiple headers or by pattern, then use xref:removeHeaders-eip.adoc[Remove Headers]. \ No newline at end of file +Camel provides the following EIPs for removing headers or exchange properties: + +- xref:removeHeader-eip.adoc[Remove Header] - To remove a single header +- xref:removeHeaders-eip.adoc[Remove Headers] - To remove one or more message headers +- xref:removeProperty-eip.adoc[Remove Property] - To remove a single exchange property +- xref:removeProperties-eip.adoc[Remove Properties] - To remove one or more exchange properties diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc index e43374e..408df19 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeaders-eip.adoc @@ -40,7 +40,7 @@ And in XML: ---- <route> <from uri="seda:b"/> - <removeHeader name="*"/> + <removeHeaders pattern="*"/> <to uri="mock:result"/> </route> ---- @@ -62,11 +62,16 @@ And in XML: ---- <route> <from uri="seda:b"/> - <removeHeader name="Camel*"/> + <removeHeaders pattern="Camel*"/> <to uri="mock:result"/> </route> ---- == See Also -To remove a single header, then you can use xref:removeHeader-eip.adoc[Remove Header]. \ No newline at end of file +Camel provides the following EIPs for removing headers or exchange properties: + +- xref:removeHeader-eip.adoc[Remove Header] - To remove a single header +- xref:removeHeaders-eip.adoc[Remove Headers] - To remove one or more message headers +- xref:removeProperty-eip.adoc[Remove Property] - To remove a single exchange property +- xref:removeProperties-eip.adoc[Remove Properties] - To remove one or more exchange properties diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc index 11f392d..a202802 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperties-eip.adoc @@ -5,7 +5,8 @@ :since: :supportlevel: Stable -The RemoveProperties EIP allows you to remove Properties from you exchange. +The Remove Properties EIP allows you to remove one or more `Exchange` properties, +based on pattern syntax. == Options @@ -13,31 +14,66 @@ The RemoveProperties EIP allows you to remove Properties from you exchange. include::partial$eip-options.adoc[] // eip options: END -== Examples +== Remove Properties by pattern -The following example shows how to use the removeProperties EIP +The Remove Properties EIP supports pattern +matching by the following rules in the given order: + +* match by exact name +* match by wildcard +* match by regular expression + +== Remove all properties [source,java] ---- -RouteBuilder builder = new RouteBuilder() { - public void configure() { - from("direct:a") - .removeProperties("myProperty", "myProperty1") - .to("direct:b"); - } -}; +from("seda:b") + .removeProperties("*") + .to("mock:result"); +---- + +And in XML: + +[source,xml] +---- +<route> + <from uri="seda:b"/> + <removeProperties pattern="*"/> + <to uri="mock:result"/> +</route> ---- +NOTE: Be careful to remove all exchange properties as Camel uses internally exchange properties +to keep state on the `Exchange` during routing. So use this with care. You should generally only remove +custom exchange properties that are under your own control. + +== Remove properties by pattern -And the same example using XML: +To remove all exchange properties that start with `Foo` then use `Foo*` as shown: + +[source,java] +---- +from("seda:b") + .removeProperties("Foo*") + .to("mock:result"); +---- + +And in XML: [source,xml] ---- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:a"/> - <removeProperties pattern="myProperty*"/> - <to uri="direct:b"/> - </route> -</camelContext> +<route> + <from uri="seda:b"/> + <removeProperties pattern="Foo*"/> + <to uri="mock:result"/> +</route> ---- + +== See Also + +Camel provides the following EIPs for removing headers or exchange properties: + +- xref:removeHeader-eip.adoc[Remove Header] - To remove a single header +- xref:removeHeaders-eip.adoc[Remove Headers] - To remove one or more message headers +- xref:removeProperty-eip.adoc[Remove Property] - To remove a single exchange property +- xref:removeProperties-eip.adoc[Remove Properties] - To remove one or more exchange properties diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperty-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperty-eip.adoc index e4749569..56b0554 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperty-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeProperty-eip.adoc @@ -5,7 +5,7 @@ :since: :supportlevel: Stable -The RemoveProperty EIP allows you to remove a Property from your exchange. +The Remove Property EIP allows you to remove a single property from the `Exchange`. == Options @@ -13,31 +13,33 @@ The RemoveProperty EIP allows you to remove a Property from your exchange. include::partial$eip-options.adoc[] // eip options: END -== Examples +== Example -The following example shows how to use the Remove Property EIP +We want to remove an exchange property with key "myProperty" from the exchange: [source,java] ---- -RouteBuilder builder = new RouteBuilder() { - public void configure() { - from("direct:a") - .removeProperty("myProperty") - .to("direct:b"); - } -}; +from("seda:b") + .removeProperty("myProperty") + .to("mock:result"); ---- - -And the same example using XML: +And in XML: [source,xml] ---- -<camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="direct:a"/> - <removeProperty propertyName="myProperty"/> - <to uri="direct:b"/> - </route> -</camelContext> +<route> + <from uri="seda:b"/> + <removeProperty name="myProperty"/> + <to uri="mock:result"/> +</route> ---- + +== See Also + +Camel provides the following EIPs for removing headers or exchange properties: + +- xref:removeHeader-eip.adoc[Remove Header] - To remove a single header +- xref:removeHeaders-eip.adoc[Remove Headers] - To remove one or more message headers +- xref:removeProperty-eip.adoc[Remove Property] - To remove a single exchange property +- xref:removeProperties-eip.adoc[Remove Properties] - To remove one or more exchange properties diff --git a/docs/user-manual/modules/faq/pages/how-to-remove-the-http-protocol-headers-in-the-camel-message.adoc b/docs/user-manual/modules/faq/pages/how-to-remove-the-http-protocol-headers-in-the-camel-message.adoc index b9b1eb1..a4e4864 100644 --- a/docs/user-manual/modules/faq/pages/how-to-remove-the-http-protocol-headers-in-the-camel-message.adoc +++ b/docs/user-manual/modules/faq/pages/how-to-remove-the-http-protocol-headers-in-the-camel-message.adoc @@ -25,8 +25,6 @@ remove these headers as follows: [source,java] ---- from("jetty://http://myhost:9000/myservice/") - // Remove the header which name is start with CamelHttp, this DSL is new to Camel 2.3.0 - // You can use removeHeader if your camel version is lower than 2.3.0 .removeHeaders("CamelHttp*") .to("otherEndpoint"); ----