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
Copy file name to clipboardExpand all lines: _data/versioned/main/index/quarkus.yaml
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -236,7 +236,7 @@ types:
236
236
- title: Security vulnerability detection and reporting in Quarkus
237
237
filename: security-vulnerability-detection.adoc
238
238
summary: Most of the Quarkus tags are registered in the US National Vulnerability Database (NVD) in Common Platform Enumeration (CPE) name format.
239
-
categories: "security, contributing"
239
+
categories: "contributing, security"
240
240
id: security-vulnerability-detection
241
241
type: concepts
242
242
url: /guides/security-vulnerability-detection
@@ -273,7 +273,7 @@ types:
273
273
- title: Building a Native Executable
274
274
filename: building-native-image.adoc
275
275
summary: Build native executables with GraalVM or Mandrel.
276
-
categories: "native, getting-started"
276
+
categories: "getting-started, native"
277
277
type: tutorial
278
278
url: /guides/building-native-image
279
279
- title: Collect metrics using Micrometer
@@ -394,7 +394,7 @@ types:
394
394
- title: AppCDS
395
395
filename: appcds.adoc
396
396
summary: This reference guide explains how to enable AppCDS with Quarkus.
397
-
categories: "cloud, core"
397
+
categories: "core, cloud"
398
398
type: guide
399
399
url: /guides/appcds
400
400
- title: Application Data Caching
@@ -528,7 +528,7 @@ types:
528
528
- title: Deploying on OpenShift
529
529
filename: deploying-to-openshift.adoc
530
530
summary: This guide covers how to deploy a native application on OpenShift.
531
-
categories: "cloud, native"
531
+
categories: "native, cloud"
532
532
id: deploy-openshift
533
533
type: guide
534
534
url: /guides/deploying-to-openshift
@@ -813,7 +813,7 @@ types:
813
813
- title: Kubernetes extension
814
814
filename: deploying-to-kubernetes.adoc
815
815
summary: This guide covers how to deploy a native application on Kubernetes.
816
-
categories: "cloud, native"
816
+
categories: "native, cloud"
817
817
id: deploy-kubernetes
818
818
type: guide
819
819
url: /guides/deploying-to-kubernetes
@@ -1057,7 +1057,7 @@ types:
1057
1057
- title: SmallRye Fault Tolerance
1058
1058
filename: smallrye-fault-tolerance.adoc
1059
1059
summary: This guide demonstrates how your Quarkus application can utilize the SmallRye Fault Tolerance specification through the SmallRye Fault Tolerance extension.
1060
-
categories: "web, observability"
1060
+
categories: "observability, web"
1061
1061
type: guide
1062
1062
url: /guides/smallrye-fault-tolerance
1063
1063
- title: SmallRye GraphQL
@@ -1087,7 +1087,7 @@ types:
1087
1087
- title: Testing Your Application
1088
1088
filename: getting-started-testing.adoc
1089
1089
summary: "This guide covers testing in JVM mode, native mode, and injection of resources into tests"
Copy file name to clipboardExpand all lines: _versions/main/guides/vertx-reference.adoc
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1008,6 +1008,52 @@ On macOS Sierra and above you can enable the following socket options:
1008
1008
quarkus.http.so-reuse-port=true
1009
1009
----
1010
1010
1011
+
== Use a Vert.x context-aware scheduler
1012
+
1013
+
Some Mutiny operators need to schedule work on an executor thread pool.
1014
+
A good example is `.onItem().delayIt().by(Duration.ofMillis(10)` as it needs such an executor to delay emissions.
1015
+
1016
+
The default executor is returned by `io.smallrye.mutiny.infrastructure.Infrastructure` and it is already configured and managed by Quarkus.
1017
+
1018
+
That being said, there are cases where you need to make sure that an operation is run on a Vert.x (duplicated) context and not just on any random thread.
1019
+
1020
+
The `io.smallrye.mutiny.vertx.core.ContextAwareScheduler` interface offers an API to obtain context-aware schedulers.
1021
+
Such a scheduler is configured with:
1022
+
1023
+
1. a delegate `ScheduledExecutorService` of your choice (hint: you can reuse `Infrastructure.getDefaultWorkerPool()`), and
1024
+
2. a context fetching strategy among:
1025
+
- an explicit `Context`, or
1026
+
- calling `Vertx::getOrCreateContext()` either on the current thread or later when the scheduling request happens, or
1027
+
- calling `Vertx::currentContext()`, which fails if the current thread is not a Vert.x thread.
1028
+
1029
+
Here is a sample where `ContextAwareScheduler` is used:
1030
+
1031
+
[source,java]
1032
+
----
1033
+
class MyVerticle extends AbstractVerticle {
1034
+
1035
+
@Override
1036
+
public Uni<Void> asyncStart() {
1037
+
vertx.getOrCreateContext().put("foo", "bar");
1038
+
1039
+
var delegate = Infrastructure.getDefaultWorkerPool();
1040
+
var scheduler = ContextAwareScheduler.delegatingTo(delegate)
In this example a scheduler is created by capturing the context of the Vert.x event-loop that calls `asyncStart()`.
1055
+
The `delayIt` operator uses that scheduler, and we can check that the context that we get in `invoke` is a Vert.x duplicated context where the data for key `"foo"` has been propagated.
1056
+
1011
1057
== Use a Unix domain socket
1012
1058
1013
1059
Listening on a Unix domain socket allows us to dispense with the overhead of TCP
0 commit comments