Remove Properties
The Remove Properties EIP allows you to remove one or more Exchange properties, based on pattern syntax.
Options
The Remove Properties eip supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
note | The note for this node. | String | |
description | The description for this node. | String | |
disabled | Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime. | false | Boolean |
pattern | Required Name or pattern of properties to remove. Supports exact match, wildcard (ending with *), and regular expression (all case-insensitive). | String | |
excludePattern | Name or pattern of properties to not remove. Supports exact match, wildcard (ending with *), and regular expression (all case-insensitive). To keep several properties, use a regular expression such as prop1|prop3. | String |
Message Body
The message body at each side of the Remove Properties EIP: EIP input is the body it needs, EIP output the body after it, and Steps the body its own steps start with.
| Side | Body | Description |
|---|---|---|
EIP output |
| Removes exchange properties: the body stays as it was. |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Remove Exchange Properties by pattern
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
For example to remove all properties use * as follows:
-
Java
-
XML
-
YAML
from("seda:b")
.removeProperties("*")
.to("mock:result"); <route>
<from uri="seda:b"/>
<removeProperties pattern="*"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: seda:b
steps:
- removeProperties:
pattern: "*"
- to:
uri: mock:result 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
To remove all exchange properties that start with Foo then use Foo* as shown:
-
Java
-
XML
-
YAML
from("seda:b")
.removeProperties("Foo*")
.to("mock:result"); <route>
<from uri="seda:b"/>
<removeProperties pattern="Foo*"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: seda:b
steps:
- removeProperties:
pattern: "Foo*"
- to:
uri: mock:result Keeping some properties
The excludePattern option keeps the exchange properties it matches, with the same rules as pattern. It is a single pattern: to keep several properties, use a regular expression with | (a comma does not separate patterns). In Java, you can also give several exclude patterns as arguments.
The following removes the exchange properties that start with Foo, except FooKeep and FooToo:
-
Java
-
XML
-
YAML
from("seda:b")
.removeProperties("Foo*", "FooKeep", "FooToo")
.to("mock:result"); <route>
<from uri="seda:b"/>
<removeProperties pattern="Foo*" excludePattern="FooKeep|FooToo"/>
<to uri="mock:result"/>
</route> - route:
from:
uri: seda:b
steps:
- removeProperties:
pattern: "Foo*"
excludePattern: "FooKeep|FooToo"
- to:
uri: mock:result See Also
Camel provides the following EIPs for removing headers or exchange properties:
-
Remove Header: To remove a single header
-
Remove Headers: To remove one or more message headers
-
Remove Property: To remove a single exchange property
-
Remove Properties: To remove one or more exchange properties