This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch rest-to in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2987ded8dc40eedbec3010495a82b3622ff7a7cf Author: Claus Ibsen <[email protected]> AuthorDate: Tue Feb 22 12:53:45 2022 +0100 CAMEL-17675: camel-core - Rest DSL remove support for using inlined routes. --- .../ROOT/pages/camel-3x-upgrade-guide-3_16.adoc | 86 +++++++++++++++++++--- 1 file changed, 75 insertions(+), 11 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc index 8ac2aa2..0bcaf54 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_16.adoc @@ -17,20 +17,69 @@ to keep the existing and ignore the duplicate. Removed the deprecated class `org.apache.camel.impl.RouteIdFactory`. -==== Rest DSL +=== Rest DSL -The generic verb-based definition, where the HTTP verb can be specified as a string value -is no longer supported for defining a REST service. -Only the built-in verbs (get, post, put etc.) must be used. +The Rest DSL have some changes. -Renamed the following classes in package `org.apache.camel.model.rest`: +==== Removed support for embedded routes -- `DeleteVerbDefinition` to `DeleteDefinition` -- `GetVerbDefinition` to `GetDefinition` -- `HeadVerbDefinition` to `HeadDefinition` -- `PatchVerbDefinition` to `PatchDefinition` -- `PostVerbDefinition` to `PostDefinition` -- `PutVerbDefinition` to `PutDefinition` +The Rest DSL no longer allows embedding routes directly into each REST service. +Instead, you must use `to` to route to a Camel endpoint. If you have an embedded +route you can them make this into an individual route using `direct` as the input endpoint, +and then link to this route from the REST service. + +For example + +[source,java] +---- +rest("/users") + .get("/{id}") + .route(). + // embedded route here +---- + +Should now be: + +[source,java] +---- +rest("/users") + .get("/{id}") + .to("direct:users-by-id"); + +from("direct:users-by-id") + // embedded route here +---- + +And in XML: + +[source,xml] +---- +<rest path="/users"> + <get path="/{id}"> + <route> + ... + </route> + </get> +</rest> +---- + +Should now be: + +[source,xml] +---- +<rest path="/users"> + <get path="/{id}"> + <to uri="direct:users-by-id"/> + </get> +</rest> + +<route> + <from uri="direct:users-by-id"/> + ... +</route> +---- + +==== Renamed uri to path Rename `uri` to `path` on the verb classes listed above. When using XML or YAML DSL then migration is needed such as: @@ -75,6 +124,21 @@ rest: to: "direct:hello" ---- +==== Renamed classes + +The generic verb-based definition, where the HTTP verb can be specified as a string value +is no longer supported for defining a REST service. +Only the built-in verbs (get, post, put etc.) must be used. + +Renamed the following classes in package `org.apache.camel.model.rest`: + +- `DeleteVerbDefinition` to `DeleteDefinition` +- `GetVerbDefinition` to `GetDefinition` +- `HeadVerbDefinition` to `HeadDefinition` +- `PatchVerbDefinition` to `PatchDefinition` +- `PostVerbDefinition` to `PostDefinition` +- `PutVerbDefinition` to `PutDefinition` + ==== Saga EIP Removed the deprecated `timeoutInMilliseconds` option, use `timeout` instead.
