You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or you can call `router` function directly in the `RSocketRequestHandlerBuilder` context – it will automatically
35
+
install router on the given context.
55
36
56
-
So, as you can see, library provides `router` function for `RSocketRequestHandler` context. It has
57
-
a few customization settings for handling routing in your own style. In addition to it, for convenience, library also provides its own interceptors API (for processing `Payload`) with
58
-
kotlin coroutines and modifications. You can take a look at them [here](router-core/src/commonMain/kotlin/com.y9vad9.rsocket.router/interceptors/Interceptor.kt).
37
+
### Routing Builder
38
+
You can define routes using bundled DSL-Builder functions:
39
+
```kotlin
40
+
fun RoutingBuilder.usersRoute(): Unit= route("users") {
41
+
// extension function that wraps RSocket `requestResponse` into `route` with given path.
42
+
requestResponse("get") { payload ->TODO() }
59
43
60
-
### Testing
44
+
// ... other
45
+
}
46
+
```
47
+
> **Note** <br>
48
+
> The library does not include the functionality to add routing to a `metadataPush` type of request. I am not sure
49
+
> how it should be exactly implemented (API), so your ideas are welcome. For now, I consider it as per-project responsibility.
50
+
### Interceptors
51
+
> **Warning** <br>
52
+
> Interceptors are experimental feature: API can be changed in the future.
61
53
62
-
`rsocket-kotlin-router` provides ability to test your routes with `router-test` artifact:
54
+
#### Preprocessors
55
+
Preprocessors are utilities that run before routing feature applies. For cases, when you need to transform input into something or propagate
56
+
values using coroutines – you can extend [`Preprocessor.Modifier`](https://github.com/y9vad9/rsocket-kotlin-router/blob/2a794e9a8c5d2ac53cb87ea58cfbe4a2ecfa217d/router-core/src/commonMain/kotlin/com.y9vad9.rsocket.router/interceptors/Interceptor.kt#L39) or [`Preprocessor.CoroutineContext`](https://github.com/y9vad9/rsocket-kotlin-router/blob/master/router-core/src/commonMain/kotlin/com.y9vad9.rsocket.router/interceptors/Interceptor.kt#L31). Here's an example:
0 commit comments