Skip to content

Commit 9091cc6

Browse files
committed
Sync documentation of main branch
1 parent 1d76861 commit 9091cc6

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

_versions/main/guides/_attributes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
:jandex-gradle-plugin-version: 2.3.0
3838
:kotlin-version: 2.3.0
3939
:grpc-version: 1.78.0
40-
:protoc-version: 4.32.1
40+
:protoc-version: 4.33.2
4141
:gcf-invoker-version: 1.4.1
4242
// Cannot simply use the name 'hibernate-*-version' here as it somehow gets
4343
// overridden to the full version, at least when building locally.

_versions/main/guides/cdi-reference.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,12 @@ Further, if the observer declares a return type of `Uni<>`, the returned `Uni` w
15221522

15231523
Therefore, it is recommended that observer methods, both synchronous and asynchronous, are always declared `void`.
15241524

1525+
=== Reactive startup methods
1526+
1527+
As documented in xref:lifecycle.adoc#startup_annotation[the `@Startup` method documentation], you may define startup
1528+
methods that return a `Uni`, in which case they will be invoked on an event thread instead of a blocking thread, and
1529+
their returned `Uni` will be subscribed to and awaited.
1530+
15251531
[[build_time_apis]]
15261532
== Build Time Extensions
15271533

_versions/main/guides/hibernate-panache-next.adoc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,25 +1067,18 @@ public class OnStart {
10671067
}
10681068
----
10691069

1070-
For reactive operations, it is a little more complex at the moment, because you need a regular `@Startup` method,
1071-
from which you invoke your reactive `@WithTransaction` method from within a call to
1072-
`VertxContextSupport.subscribeAndAwait` (don't worry, we are working on making this easier):
1070+
For reactive operations, it is fairly similar:
10731071

10741072
[source,java]
10751073
----
10761074
import io.quarkus.hibernate.reactive.panache.common.WithTransaction;
10771075
import io.quarkus.runtime.Startup;
1078-
import io.quarkus.vertx.VertxContextSupport;
10791076
import io.smallrye.mutiny.Uni;
10801077
10811078
public class OnStart {
10821079
@Startup
1083-
public void start() throws Throwable {
1084-
VertxContextSupport.subscribeAndAwait(() -> runit());
1085-
}
1086-
10871080
@WithTransaction
1088-
Uni<Void> runit(){
1081+
Uni<Void> startupMethod(){
10891082
return Cat_.repo().deleteAll().replaceWithVoid();
10901083
}
10911084
}

_versions/main/guides/lifecycle.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,17 @@ public class EagerAppBean {
264264
void init() { <1>
265265
doSomeCoolInit();
266266
}
267+
268+
@Startup
269+
Uni<Void> initReactive() { <2>
270+
return doSomeCoolReactiveInit();
271+
}
267272
}
268273
----
269274
<1> The bean is created and the `init()` method is invoked upon the contextual instance when the application starts.
275+
<2> The bean is created and the `initReactive()` method is invoked upon the contextual instance when the application
276+
starts, on a non-blocking thread, which requires the Quarkus Vert.x extension (there will be an error if it is not
277+
present).
270278

271279
[[shutdown_annotation]]
272280
=== Using `@Shutdown` to execute a business method of a CDI bean during application shutdown

0 commit comments

Comments
 (0)