Skip to content

Commit

Permalink
Merge branch 'main' into 35915
Browse files Browse the repository at this point in the history
  • Loading branch information
ejba authored Sep 18, 2023
2 parents ae0f6bb + f786f4a commit 21a5e2d
Show file tree
Hide file tree
Showing 54 changed files with 539 additions and 378 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-istio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
shell: bash
run: tar -xzf maven-repo.tgz -C ~
- name: Set up Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2
uses: manusa/actions-setup-minikube@v2.9.0
with:
minikube version: v1.16.0
kubernetes version: ${{ matrix.kubernetes }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
shell: bash
run: tar -xzf maven-repo.tgz -C ~
- name: Set up Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.7.2
uses: manusa/actions-setup-minikube@v2.9.0
with:
minikube version: v1.16.0
kubernetes version: ${{ matrix.kubernetes }}
Expand Down
8 changes: 4 additions & 4 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<jakarta.websocket-api.version>2.1.1</jakarta.websocket-api.version>
<jakarta.ws.rs-api.version>3.1.0</jakarta.ws.rs-api.version>
<jakarta.xml.bind-api.version>4.0.0</jakarta.xml.bind-api.version>
<jakarta.xml.bind-api.version>4.0.1</jakarta.xml.bind-api.version>
<jaxb-runtime.version>4.0.3</jaxb-runtime.version>
<asm.version>9.5</asm.version>
<commons-io.version>2.13.0</commons-io.version>
Expand Down Expand Up @@ -189,16 +189,16 @@
<jna.version>5.8.0</jna.version><!-- should satisfy both testcontainers and mongodb -->
<antlr.version>4.10.1</antlr.version><!-- needs to align with same property in build-parent/pom.xml -->
<quarkus-security.version>2.0.2.Final</quarkus-security.version>
<keycloak.version>22.0.1</keycloak.version>
<keycloak.version>22.0.3</keycloak.version>
<logstash-gelf.version>1.15.1</logstash-gelf.version>
<checker-qual.version>3.37.0</checker-qual.version>
<checker-qual.version>3.38.0</checker-qual.version>
<error-prone-annotations.version>2.20.0</error-prone-annotations.version>
<jib-core.version>0.24.0</jib-core.version>
<google-http-client.version>1.43.3</google-http-client.version>
<scram-client.version>2.1</scram-client.version>
<picocli.version>4.7.5</picocli.version>
<google-cloud-functions.version>1.1.0</google-cloud-functions.version>
<commons-compress.version>1.23.0</commons-compress.version>
<commons-compress.version>1.24.0</commons-compress.version>
<commons-text.version>1.10.0</commons-text.version>
<gson.version>2.10.1</gson.version>
<log4j2-jboss-logmanager.version>1.1.1.Final</log4j2-jboss-logmanager.version>
Expand Down
4 changes: 2 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

<!-- The image to use for tests that run Keycloak -->
<!-- IMPORTANT: If this is changed you must also update bom/application/pom.xml and KeycloakBuildTimeConfig/DevServicesConfig in quarkus-oidc/deployment to match the version -->
<keycloak.version>22.0.1</keycloak.version>
<keycloak.version>22.0.3</keycloak.version>
<keycloak.wildfly.version>19.0.3</keycloak.wildfly.version>
<keycloak.docker.image>quay.io/keycloak/keycloak:${keycloak.version}</keycloak.docker.image>
<keycloak.docker.legacy.image>quay.io/keycloak/keycloak:${keycloak.wildfly.version}-legacy</keycloak.docker.legacy.image>
Expand All @@ -114,7 +114,7 @@
<wiremock-maven-plugin.version>7.3.0</wiremock-maven-plugin.version>

<!-- Artemis test dependencies -->
<artemis.version>2.29.0</artemis.version>
<artemis.version>2.30.0</artemis.version>

<!-- Code Coverage Properties-->
<jacoco.agent.argLine></jacoco.agent.argLine>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,8 @@ private Converter<?> getConverter(SmallRyeConfig config, Field field, ConverterT
* properties in all profiles (active or not), so it is safe to fall back to different default on another
* profile.
* <br>
* We also filter the properties coming from System or Env with the registered roots, because we don't want to
* record properties set by the compiling JVM (or other properties that are only related to the build).
* We also filter the properties coming from System, Env or Build with the registered roots, because we don't
* want to record properties set by the compiling JVM (or other properties that are only related to the build).
*/
private Set<String> getAllProperties(final Set<String> registeredRoots) {
Set<String> properties = new HashSet<>();
Expand All @@ -1023,7 +1023,8 @@ private Set<String> getAllProperties(final Set<String> registeredRoots) {
}

for (ConfigSource configSource : config.getConfigSources()) {
if (configSource instanceof SysPropConfigSource || configSource instanceof EnvConfigSource) {
if (configSource instanceof SysPropConfigSource || configSource instanceof EnvConfigSource
|| "PropertiesConfigSource[source=Build system]".equals(configSource.getName())) {
for (String property : configSource.getPropertyNames()) {
NameIterator ni = new NameIterator(property);
if (ni.hasNext() && PropertiesUtil.isPropertyInRoot(registeredRoots, ni)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@ public NativeImageInvokerInfo build() {
"-H:BuildOutputJSONFile=" + nativeImageName + "-build-output-stats.json");
}

// only available in GraalVM 23.1.0+. Expected to become the default in GraalVM 24.0.0.
if (graalVMVersion.compareTo(GraalVM.Version.VERSION_23_1_0) >= 0) {
nativeImageArgs.add("--strict-image-heap");
}

/*
* Any parameters following this call are forced over the user provided parameters in
* quarkus.native.additional-build-args. So if you need a parameter to be overridable through
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class NativeImageFeatureStep {
@BuildStep
void addExportsToNativeImage(BuildProducer<JPMSExportBuildItem> features) {
// required in order to access org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport
// prior to 23.1 the class was provided by org.graalvm.sdk module and with 23.1 onwards, it's provided by org.graalvm.nativimage instead
// prior to 23.1 the class was provided by org.graalvm.sdk module and with 23.1 onwards, it's provided by org.graalvm.nativeimage instead
features.produce(new JPMSExportBuildItem("org.graalvm.sdk", "org.graalvm.nativeimage.impl", null,
GraalVM.Version.VERSION_23_1_0));
features.produce(new JPMSExportBuildItem("org.graalvm.nativeimage", "org.graalvm.nativeimage.impl",
Expand Down
65 changes: 40 additions & 25 deletions docs/src/main/asciidoc/datasource.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include::_attributes.adoc[]
:diataxis-type: reference
:categories: data,getting-started,reactive

Use a unified configuration model to define datasources for Java Database Connectivity (JDBC) and Reactive drivers.
Use a unified configuration model to define data sources for Java Database Connectivity (JDBC) and Reactive drivers.

////
Note for contributors and writers:
Expand All @@ -20,38 +20,36 @@ See, https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html
Applications use datasources to access relational databases.
Quarkus provides a unified configuration model to define datasources for Java Database Connectivity (JDBC) and Reactive database drivers.

Quarkus uses link:https://agroal.github.io/[Agroal] and link:https://vertx.io/[Vert.x] to provide high-performance, scaleable data source connection pooling for JDBC and reactive drivers.
Quarkus uses link:https://agroal.github.io/[Agroal] and link:https://vertx.io/[Vert.x] to provide high-performance, scalable data source connection pooling for JDBC and reactive drivers.
The `jdbc-\*` and `reactive-*` extensions provide build time optimizations and integrate configured data sources with Quarkus features like security, health checks, and metrics.

For more information on consuming and using a reactive datasource, consult the Quarkus xref:reactive-sql-clients.adoc[Reactive SQL clients] guide.
For more information about consuming and using a reactive datasource, see the Quarkus xref:reactive-sql-clients.adoc[Reactive SQL clients] guide.

Additionally, refer to the Quarkus xref:hibernate-orm.adoc[Hibernate ORM] guide for information on consuming and using a JDBC datasource.


////
Future references to all other parts of this doc.
////

== Get started with configuring `datasources` in Quarkus

For rapid configuration of datasources, this section offers a brief overview and code samples for testing and utilization, suitable for users familiar with the fundamentals.

For more advanced configuration with examples, see xref:datasource-reference[Datasource references].
For more advanced configuration with examples, see <<datasource-reference>>.

[[dev-services]]
=== Zero-config setup in development mode

Quarkus simplifies database configuration by offering the Dev Services feature, enabling zero-config database setup for testing or running in dev mode.
Quarkus simplifies database configuration by offering the Dev Services feature, enabling zero-config database setup for testing or running in development (dev) mode.
In dev mode, the suggested approach is to use DevServices and let Quarkus handle the database for you, whereas for production mode, you provide explicit database configuration details pointing to a database managed outside of Quarkus.

To use Dev Services, add the appropriate driver extension, such as `jdbc-postgresql`, for your desired database type to the `pom.xml` file.
In Dev mode, if you do not provide any explicit database connection details, Quarkus automatically handles the database setup and provides the wiring between the application and the database.
In dev mode, if you do not provide any explicit database connection details, Quarkus automatically handles the database setup and provides the wiring between the application and the database.

If you provide user credentials, the underlying database will be configured to use them.
This is useful if you want to connect to the database with an external tool.

To utilize this feature, ensure a Docker or Podman container runtime is installed, depending on the database type. Certain databases, such as H2, operate in in-memory mode and do not require a container runtime.

TIP: Prefix the actual connection details for Prod mode with `%prod.` to ensure they are not applied in Dev mode. For more information, see the xref:config-reference.adoc#profiles[Profiles] section of the xref:config-reference.adoc[Configuration reference] guide.
TIP: Prefix the actual connection details for prod mode with `%prod.` to ensure they are not applied in dev mode.
For more information, see the xref:config-reference.adoc#profiles[Profiles] section of the "Configuration reference" guide.

For more information about Dev Services, see xref:dev-services.adoc[Dev Services overview].

Expand Down Expand Up @@ -85,7 +83,17 @@ quarkus.datasource.jdbc.max-size=16
<1> This configuration value is only required if there is more than one database extension on the classpath.

If only one viable extension is available, Quarkus assumes this is the correct one.
If a driver has been added to the test scope, Quarkus automatically includes the driver in testing.
When you add a driver to the test scope, Quarkus automatically includes the specified driver in testing.

==== JDBC connection pool size adjustment

To protect your database from overloading during load peaks, size the pool adequately to throttle the database load.
The optimal pool size depends on many factors, such as the number of parallel application users or the nature of the workload.

Be aware that setting the pool size too low might cause some requests to time out while waiting for a connection.

For more information about pool size adjustment properties, see the <<jdbc-configuration>> section.


=== Configure a reactive datasource

Expand Down Expand Up @@ -175,7 +183,6 @@ JDBC is the most common database connection pattern, typically needed when used

.. For use with a built-in JDBC driver, choose and add the Quarkus extension for your relational database driver from the list below:
+

* Derby - `jdbc-derby`
* H2 - `jdbc-h2`
+
Expand Down Expand Up @@ -206,6 +213,7 @@ Using a built-in JDBC driver extension automatically includes the Agroal extensi
However, for custom drivers, Agroal needs to be added explicitly.
====


.. For use with a custom JDBC driver, add the `quarkus-agroal` dependency to your project alongside the extension for your relational database driver:
+
[source,bash]
Expand Down Expand Up @@ -236,7 +244,8 @@ For more information about configuring JDBC, see <<jdbc-url,JDBC URL format refe
[[other-databases]]
===== Custom databases and drivers

If you need to connect to a database for which Quarkus does not provide an extension with the JDBC driver, you can use a custom driver instead. For example, if you are using the OpenTracing JDBC driver in your project.
If you need to connect to a database for which Quarkus does not provide an extension with the JDBC driver, you can use a custom driver instead.
For example, if you are using the OpenTracing JDBC driver in your project.

Without an extension, the driver will work correctly in any Quarkus app running in JVM mode.
However, the driver is unlikely to work when compiling your application to a native executable.
Expand Down Expand Up @@ -278,11 +287,9 @@ AgroalDataSource defaultDataSource;
In the above example, the type is `AgroalDataSource`, a `javax.sql.DataSource` subtype.
Because of this, you can also use `javax.sql.DataSource` as the injected type.


==== Reactive datasource

Quarkus offers several reactive clients for a use with reactive datasource.

Quarkus offers several reactive clients for use with a reactive datasource.

. Add the corresponding extension to your application:
+
Expand All @@ -302,6 +309,16 @@ quarkus.datasource.reactive.url=postgresql:///your_database
quarkus.datasource.reactive.max-size=20
----

===== Reactive connection pool size adjustment

To protect your database from overloading during load peaks, size the pool adequately to throttle the database load.
The proper size always depends on many factors, such as the number of parallel application users or the nature of the workload.

Be aware that setting the pool size too low might cause some requests to time out while waiting for a connection.

For more information about pool size adjustment properties, see the <<reactive-configuration>> section.


==== JDBC and reactive datasources simultaneously

When a JDBC extension - along with Agroal - and a reactive datasource extension handling the given database kind are included, they will both be created by default.
Expand Down Expand Up @@ -421,15 +438,15 @@ Conversely, setting `quarkus.datasource.jdbc.enable-metrics` to `true`, or `quar
This can be useful if you need to access the collected metrics programmatically.
They are available after calling `dataSource.getMetrics()` on an injected `AgroalDataSource` instance.

If the metrics collection for this datasource is disabled, all values result to zero.
If the metrics collection for this datasource is disabled, all values result in zero.

=== Narayana transaction manager integration

Integration is automatic if the Narayana JTA extension is also available.

You can override this by setting the `transactions` configuration property:

* `quarkus.datasource.jdbc.transactions` for default unnamend datasource
* `quarkus.datasource.jdbc.transactions` for default unnamed datasource
* `quarkus.datasource._<datasource-name>_.jdbc.transactions` for named datasource

For more information, see the <<configuration-reference,Configuration reference>> section below.
Expand All @@ -450,19 +467,17 @@ Some databases like H2 and Derby are commonly used in the _embedded mode_ as a f
The recommended approach is to use the real database you intend to use in production, especially when xref:databases-dev-services.adoc[Dev Services provide a zero-config database for testing], and running tests against a container is relatively quick and produces expected results on an actual environment.
However, it is also possible to use JVM-powered databases for scenarios when the ability to run simple integration tests is required.

NOTE: While configuring Derby to use the embedded engine works as usual in JVM mode, such an application will not compile into a native executable. It is because Quarkus Derby extensions do not support embedding the entire database engine into a native executable, and it only covers making the JDBC client code compatible with the native compilation step.

==== Support and limitations

Embedded databases (H2 and Derby) work in JVM mode.
For native mode, the following limitations apply:

* Derby cannot be embedded into the application in native mode, and only remote connection is supported.
[IMPORTANT]
====
Embedding H2 within your native image is not recommended.
* Derby cannot be embedded into the application in native mode.
However, the Quarkus Derby extension allows native compilation of the Derby JDBC *client*, supporting *remote* connections.

* Embedding H2 within your native image is not recommended.
Consider using an alternative approach, for example, using a remote connection to a separate database instead.
====

==== Run an integration test

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/deploying-to-kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ To enable Service Binding for supported extensions, add the `quarkus-kubernetes-
* `quarkus-jdbc-mssql`
* `quarkus-jdbc-mysql`
* `quarkus-jdbc-postgresql`
* `quarkus-mongo-client`
* `quarkus-mongodb-client`
* `quarkus-kafka-client`
* `quarkus-smallrye-reactive-messaging-kafka`
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/jms.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ You can follow the instructions from the https://activemq.apache.org/components/

[source,bash]
----
docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:0.1.4
docker run -it --rm -p 8161:8161 -p 61616:61616 -p 5672:5672 -e AMQ_USER=quarkus -e AMQ_PASSWORD=quarkus quay.io/artemiscloud/activemq-artemis-broker:1.0.21
----

=== The price producer
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/kafka.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public void consume(List<Double> prices) {
}
----

The incoming method can also receive `Message<List<Payload>>`, `KafkaRecordBatch<Key, Payload>` `ConsumerRecords<Key, Payload>` types.
The incoming method can also receive `Message<List<Payload>>`, `KafkaRecordBatch<Key, Payload>`, and `ConsumerRecords<Key, Payload>` types.
They give access to record details such as offset or timestamp:

[source, java]
Expand Down
Loading

0 comments on commit 21a5e2d

Please sign in to comment.