Package com.shri.restinpeace.reactor
Class RestInPeaceReactor
java.lang.Object
com.shri.restinpeace.reactor.RestInPeaceReactor
Entry point for
rest-in-peace-reactor: registers this module's
CallAdapter/PaginatedCallAdapter
factories with RIP. Call once at startup, before
building any @RestClient - the same "configure globals first"
requirement RIP.addCallAdapterFactory(com.shri.restinpeace.CallAdapterFactory) itself already documents,
since a factory needs to be registered before
ReflectiveRestClientValidator validates a method claiming it.
RestInPeaceReactor.register(); // once, at startup
@RestClient
@BaseUrl("https://api.example.com")
interface UserApi {
@GET("/users/{id}")
Mono<User> getUser(@PathParam("id") String id);
@GET("/users")
Flux<User> listUsers(); // flavor 1 (§7.1) - a single JSON array response
@GET("/users")
@Paginated(itemsField = "users", pointerField = "next_cursor")
Flux<User> fluxUsers(@QueryParam("cursor") @PaginationCursor String cursor); // flavor 2 (§7.2) - real backpressure
}
Mono<T> and both Flux<T> flavors are registered - see
docs/design/reactor-call-adapter.md §14 for the full rollout plan.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister()static voidReversesregister()- removes this module's factories.
-
Method Details
-
register
public static void register()Registers this module'sCallAdapterFactory/PaginatedCallAdapterFactoryinstances withRIP.addCallAdapterFactory(com.shri.restinpeace.CallAdapterFactory)/RIP.addPaginatedCallAdapterFactory(com.shri.restinpeace.PaginatedCallAdapterFactory). Idempotent by identity -RequestExecutor's registries only ever add an instance that isn't already present by reference, so calling this more than once is a no-op for these singletons; harmless, but there's no reason to call it more than once. -
unregister
public static void unregister()Reversesregister()- removes this module's factories. Mainly useful for tests.
-