Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

For example given the following route:

Code Block
javajava
titleRoute
java
from("direct:start")
    .to("mock:foo")
    .to("mock:bar").id("bar")
    .to("mock:result");

...

In the example above, we add the following nodes to("mock:a").transform(constant("Bye World")) after the node with the id "bar".

Using weaveByToString

...

The {{weaveByToString}} also allows you to manipulate the route, for example by replacing a node with other nodes. As opposed to {{weaveById}}, this method uses the {{toString}} representation of the node(s) when matching. This allows you to match nodes, which may not have assigned ids, or to match [EIP] pattern.
You have to be a bit more careful when using this as the {{toString}} representation can be verbose and contain characters such as \ [ \ ] ( ) \ -> and so forth. That is why using the regular expression matching is the must useable.

The weaveByToString has the same methods as weaceById.

...