Este contenido no está disponible en el idioma seleccionado.
Chapter 14. Reference
14.1. MicroProfile Config reference Copiar enlaceEnlace copiado en el portapapeles!
14.1.1. Default MicroProfile Config attributes Copiar enlaceEnlace copiado en el portapapeles!
The MicroProfile Config specification defines three ConfigSources by default.
ConfigSources are sorted according to their ordinal number. If a configuration must be overwritten for a later deployment, the lower ordinal ConfigSource is overwritten before a higher ordinal ConfigSource.
ConfigSource | Ordinal |
|---|---|
| System properties |
|
| Environment variables |
|
|
Property files |
|
14.1.2. MicroProfile Config SmallRye ConfigSources Copiar enlaceEnlace copiado en el portapapeles!
The microprofile-config-smallrye project defines more ConfigSources you can use in addition to the default MicroProfile Config ConfigSources.
ConfigSource | Ordinal |
|---|---|
|
|
|
|
|
|
|
|
|
An explicit ordinal is not specified for these ConfigSources. They inherit the default ordinal value found in the MicroProfile Config specification.
14.2. MicroProfile Fault Tolerance reference Copiar enlaceEnlace copiado en el portapapeles!
14.2.1. MicroProfile Fault Tolerance configuration properties Copiar enlaceEnlace copiado en el portapapeles!
SmallRye Fault Tolerance specification defines the following properties in addition to the properties defined in the MicroProfile Fault Tolerance specification.
| Property | Default value | Description |
|---|---|---|
|
|
| Maximum number of threads in the thread pool. |
|
|
| Size of the queue that the thread pool should use. |
14.3. MicroProfile JWT reference Copiar enlaceEnlace copiado en el portapapeles!
14.3.1. MicroProfile Config JWT standard properties Copiar enlaceEnlace copiado en el portapapeles!
The microprofile-jwt-smallrye subsystem supports the following MicroProfile Config standard properties.
| Property | Default | Description |
|---|---|---|
| mp.jwt.verify.publickey | NONE |
String representation of the public key encoded using one of the supported formats. Do not set if you have set |
| mp.jwt.verify.publickey.location | NONE |
The location of the public key, may be a relative path or URL. Do not be set if you have set |
| mp.jwt.verify.issuer | NONE |
The expected value of any |
Example microprofile-config.properties configuration:
mp.jwt.verify.publickey.location=META-INF/public.pem mp.jwt.verify.issuer=jwt-issuer
mp.jwt.verify.publickey.location=META-INF/public.pem
mp.jwt.verify.issuer=jwt-issuer
14.4. MicroProfile OpenAPI reference Copiar enlaceEnlace copiado en el portapapeles!
14.4.1. MicroProfile OpenAPI configuration properties Copiar enlaceEnlace copiado en el portapapeles!
In addition to the standard MicroProfile OpenAPI configuration properties, JBoss EAP supports the following additional MicroProfile OpenAPI properties. These properties can be applied in both the global and the application scope.
| Property | Default value | Description |
|---|---|---|
|
|
| Enables or disables registration of an OpenAPI endpoint.
When set to
You can parameterize this property to selectively enable or disable You can use this property to control which application associated with a given virtual host should generate a MicroProfile OpenAPI model. |
|
|
| You can use this property for generating OpenAPI documentation for multiple applications associated with a virtual host.
Set a distinct |
|
|
| Indicates whether auto-generated server records are absolute or relative to the location of the OpenAPI endpoint. Server records are necessary to ensure, in the presence of a non-root context path, that consumers of an OpenAPI document can construct valid URLs to REST services relative to the host of the OpenAPI endpoint.
The value
When set to |
14.5. MicroProfile Reactive Messaging reference Copiar enlaceEnlace copiado en el portapapeles!
14.5.1. MicroProfile reactive messaging connectors for integrating with external messaging systems Copiar enlaceEnlace copiado en el portapapeles!
The following is a list of reactive messaging property key prefixes required by the MicroProfile Config specification:
-
mp.messaging.incoming.[channel-name].[attribute]=[value] -
mp.messaging.outgoing.[channel-name].[attribute]=[value] -
mp.messaging.connector.[connector-name].[attribute]=[value]
Note that channel-name is either the @Incoming.value() or the @Outgoing.value(). For clarification, look at this example of a pair of connector methods:
In this example, the required property prefixes are as follows:
-
mp.messaging.incoming.from. This defines thereceive()method. -
mp.messaging.outgoing.to. This defines thesend()method.
Remember that this is an example. Because different connectors recognize different properties, the prefixes you indicate depend on the connector you want to configure.
14.5.2. Example of the data exchange between reactive messaging streams and user-initialized code Copiar enlaceEnlace copiado en el portapapeles!
The following is an example of data exchange between reactive messaging streams and code that a user triggered through the @Channel and Emitter constructs:
In-line details:
- 1
- Wraps the constructor-injected publisher.
- 2
- You need this empty constructor to satisfy the Contexts and Dependency Injection (CDI) for Java specification.
- 3
- Subscribe to the delegate.
- 4
- Wrap the delegate in a publisher that can handle multiple subscriptions.
- 5
- The wrapping publisher forwards data from the delegate.
- 6
- Unsubscribe from the reactive messaging-provided publisher.
In this example, MicroProfile Reactive Messaging is listening to the my-stream memory stream, so messages sent through the Emitter are received on this injected publisher. Note, though, that the following conditions must be true for this data exchange to succeed:
-
There must be an active subscription on the channel before you call
Emitter.send(). In this example, notice that thesubscribeAndAllowMultipleSubscriptions()method called by the constructor ensures that there’s an active subscription by the time the bean is available for user code calls. -
You can have only one
Subscriptionon the injectedPublisher. If you want to expose the receiving publisher with a REST call, where each call to thepoll()method results in a new subscription to thedestpublisher, you have to implement your own publisher to broadcast data from the injected to each client.
14.5.3. The Apache Kafka user API Copiar enlaceEnlace copiado en el portapapeles!
You can use the Apache Kafka user API to get more information about messages Kafka received, and to influence how Kafka handles messages. This API is stored in the io/smallrye/reactive/messaging/kafka/api package, and it consists of the following classes:
IncomingKafkaRecordMetadata. This metadata contains the following information:-
The Kafka record
key, represented by aMessage. -
The Kafka
topicandpartitionused for theMessage, and theoffsetwithin those. -
The
MessagetimestampandtimestampType. -
The
Messageheaders. These are pieces of information that the application can attach on the producing side, and receive on the consuming side.
-
The Kafka record
OutgoingKafkaRecordMetadata. With this metadata, you can specify or override how Kafka handles messages. It contains the following information:-
The
key. which Kafka treats as the message key. -
The
topicyou want Kafka to use. -
The
partition. -
The
timestamp, if you don’t want the one that Kafka generates. -
headers.
-
The
-
KafkaMetadataUtilcontains utility methods to writeOutgoingKafkaRecordMetadatato aMessage, and to readIncomingKafkaRecordMetadatafrom aMessage.
If you write OutgoingKafkaRecordMetadata to a Message sent to a channel that’s not mapped to Kafka, the reactive messaging framework ignores it. Conversely, if you read IncomingKafkaRecordMetadata from a Message from a channel that’s not mapped to Kafka, that message returns as null.
Example of how to write and read a message key
Example of Kafka mapping in a microprofile-config.properties file
You must specify the key.serializer for the outgoing channel and the key.deserializer for the incoming channel.
14.5.4. Example MicroProfile Config properties file for the Kafka connector Copiar enlaceEnlace copiado en el portapapeles!
This is an example of a simple microprofile-config.properties file for a Kafka connector. Its properties correspond to the properties in the example in "MicroProfile reactive messaging connectors for integrating with external messaging systems."
| Entry | Description |
|---|---|
|
| These are "channels." |
|
| These are "methods."
Note that the |
|
|
This specifies the URL of the Kafka broker that the application must connect to. You can also specify a URL at the channel level, like this: |
|
|
This indicates that you want the
SmallRye reactive messaging is a framework for building applications. Note that the |
|
|
This indicates that you want to send data to a Kafka topic called A Kafka "topic" is a category or feed name that messages are stored on and published to. All Kafka messages are organized into topics. Producer applications write data to topics and consumer applications read data from topics. |
|
|
This tells the connector to use |
|
|
This indicates that you want to use the |
|
|
This indicates that your connector should read data from the Kafka topic called |
|
|
This tells the connector to use |
This list of properties is not comprehensive. See the SmallRye Reactive Messaging Apache Kafka documentation for more information.
Mandatory MicroProfile Reactive Messaging prefixes
The MicroProfile Reactive Messaging specification requires the following method property key prefixes for Kafka:
-
mp.messaging.incoming.[channel-name].[attribute]=[value]` -
mp.messaging.outgoing.[channel-name].[attribute]=[value]` -
mp.messaging.connector.[connector-name].[attribute]=[value]`
Note that channel-name is either the @Incoming.value() or the @Outgoing.value().
Now consider the following method pair example:
In this method pair example, note the following required property prefixes:
-
mp.messaging.incoming.from. This prefix selects the property as your configuration of thereceive()method. -
mp.messaging.outgoing.to. This prefix selects the property as your configuration of thesend()method.
14.5.4.1. Configuring a secure MicroProfile Reactive Messaging Apache Kafka connector Copiar enlaceEnlace copiado en el portapapeles!
To configure an Apache Kafka connector client using a self-signed certificate, define the client-ssl-context in the microprofile-config.properties file. You can do this on the connector and channel levels.
The following examples demonstrate how to configure an Apache Kafka connector secured with SSL/TLS.
Example of connector level client-ssl-context definition
mp.messaging.incoming.from.security.protocol=SSL mp.messaging.outgoing.to.security.protocol=SSL mp.messaging.connector.smallrye-kafka.wildfly.elytron.ssl.context=exampleSSLContext
mp.messaging.incoming.from.security.protocol=SSL
mp.messaging.outgoing.to.security.protocol=SSL
mp.messaging.connector.smallrye-kafka.wildfly.elytron.ssl.context=exampleSSLContext
The attribute mp.messaging.connector.smallrye-kafka.wildfly.elytron.ssl.context is only required when you use self-signed certificates.
Do not use self-signed certificates in a production environment. Use only the certificates signed by a Certificate Authority (CA).
You can specify the client-ssl-context for a channel as follows:
Example of channel-level client-ssl-context definition
mp.messaging.incoming.from.wildfly.elytron.ssl.context=exampleSSLContext
mp.messaging.incoming.from.wildfly.elytron.ssl.context=exampleSSLContext
In the example, the exampleSSLContext is associated only with the incoming channel from.
| Entry | Description |
|---|---|
|
| This specifies that we want to use a secure incoming channel connection when connecting to the broker. |
|
| This specifies that we want to use a secure outgoing channel connection when connecting to the broker. |
|
| You do not need to specify this attribute if the Kafka broker is secured with a Certificate Authority (CA)-signed certificate. |
If you use a self-signed certificate, specify the SSLContext that is defined in the Elytron subsystem under /subsystem=elytron/client-ssl-context=* in the management model.
Do not use self-signed certificates in a production environment. Use only the certificates signed by a Certificate Authority (CA).
You can define client-ssl-context by using the following management CLI command:
Example
/subsystem=elytron/client-ssl-context=exampleSSLContext:add(key-manager=exampleServerKeyManager,trust-manager=exampleTLSTrustManager)
/subsystem=elytron/client-ssl-context=exampleSSLContext:add(key-manager=exampleServerKeyManager,trust-manager=exampleTLSTrustManager)
When a SSL/TLS connection is used with SCRAM-SHA-512 authentication, the SSL/TLS protocol provides the encryption, but is not used for authentication. To authenticate your connection with SCRAM-SHA-512 protocol, see Configure MicroProfile Reactive Messagaging Kafka connector to use SASL_PLAINTEXT and SASL_SSL authentication protocols.
14.5.4.2. Configuring MicroProfile Reactive Messagaging Kafka connector to use SASL_PLAINTEXT and SASL_SSL authentication protocols Copiar enlaceEnlace copiado en el portapapeles!
Apache Kafka uses the Simple Authentication and Security Layer (SASL) protocol to authenticate clients that are connecting to Apache Kafka listeners. You can configure listeners to use unencrypted plain type and encrypted tls type communication. Streams for Apache Kafka uses SASL in combination with Salted Challenged Response Authentication Mechanism (SCRAM) protocol (SASL SCRAM-SHA-512) to provide authentication. You must define a Kafka custom resource and KafkaUser custom resource YAML files to configure authentication for both types of listeners.
If SASL is configured on the server, that is, Kafka listeners are configured to use SCRAM-SHA-512 authentication, the client must specify the security protocol. If connecting to a listener encrypted with TLS, this protocol should be SASL_SSL. If the listener is not encrypted, the protocol should be SASL_PLAINTEXT. The client configuration must specify the SASL mechanism by setting it to use SCRAM-SHA-512.
When SCRAM-SHA-512 authentication is used with a SSL/TLS connection, the SSL/TLS protocol provides the encryption, but is not used for authentication. To secure your connection with SSL/TLS, see Configuring a secure MicroProfile Reactive Messaging Apache Kafka connector.
Set up a client authentication for a listener that uses plain type unencrypted communication and SASL SCRAM-SHA-512 authentication.
Prerequisites
Streams for Apache Kafka cluster operator is installed.
NoteThe cluster operator generates a
Secretresource by default. Theusernameandpasswordin the client configuration must match the username and password defined by theSecretresourceFor more information about creating a custom
Secretresource, see Custom password configuration.For more information about
Secretresources generated by operators, see Secrets generated by the operators.
Procedure
Define your Kafka custom resource as a YAML file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Define your KafkaUser custom resource as a YAML file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The KafkaUser
.authenticationdefinition should match thelistener.authenticationdefinition.Configure your client in the
microprofile-config.propertiesfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
usernameandpasswordmust match the username and password in theSecretresource generated by the cluster operator.
14.5.5. Example MicroProfile Config properties file for the AMQP connector Copiar enlaceEnlace copiado en el portapapeles!
This is an example of a simple microprofile-config.properties file for an Advanced Message Queuing Protocol (AMQP) connector. Its properties correspond to the properties in the example in MicroProfile reactive messaging connectors for integrating with external messaging systems.
| Entry | Description |
|---|---|
|
| These are "channels." |
|
| These are "methods."
Note that the |
|
|
This specifies the URL of the AMQP broker that the application must connect to. You can also specify a URL at the channel level, like this: |
|
| This specifies the port of the AMQP broker. |
|
| This indicates that you want the channel to send messages to AMQP.
SmallRye reactive messaging is a framework for building applications. Note that the |
|
|
This indicates that you want to send data to an AMQP queue on the address |
|
|
This indicates that you want to use the |
|
|
This indicates that you want to read data from the AMQP queue |
For a complete list of properties supported by the SmallRye Reactive Messaging’s AMQP connector, see SmallRye Reactive Messaging AMQP Connector Configuration Reference.
Connecting to a secure AMQP broker
To connect with an AMQ broker secured with SSL/TLS and Simple Authentication and Security Layer (SASL), define the client-ssl-context to be used for the connection, in the microprofile-config.properties file. You can do this on connector level and also on channel level.
Example of connector level client-ssl-context definition
amqp-use-ssl=true mp.messaging.connector.smallrye-amqp.wildfly.elytron.ssl.context=exampleSSLContext
amqp-use-ssl=true
mp.messaging.connector.smallrye-amqp.wildfly.elytron.ssl.context=exampleSSLContext
The attribute mp.messaging.connector.smallrye-amqp.wildfly.elytron.ssl.context is only required when you use self-signed certificates.
Do not use self-signed certificates in a production environment. Use only the certificates signed by a certificate authority (CA).
You can also specify the client-ssl-context for a channel as follows:
Example of channel-level client-ssl-context definition
mp.messaging.incoming.from.wildfly.elytron.ssl.context=exampleSSLContext
mp.messaging.incoming.from.wildfly.elytron.ssl.context=exampleSSLContext
In the example, the exampleSSLContext is associated only with the incoming channel from.
| Entry | Description |
|---|---|
|
| This specifies that we want to use a secure connection when connecting to the broker. |
|
| You do not need to specify this attribute if the AMQ broker is secured with a Certificate Authority (CA)-signed certificate.
If you use a self-signed certificate, specify the Important Do not use self-signed certificates in a production environment. Use only the certificates signed by a certificate authority (CA).
You can define
/subsystem=elytron/client-ssl-context=exampleSSLContext:add(key-manager=exampleServerKeyManager,trust-manager=exampleTLSTrustManager)
For more information, see Configuring a trust store and a trust manager for client certificates, Configuring a server certificate for two-way SSL/TLS in the Configuring SSL/TLS in JBoss EAP guide. |
14.6. OpenTelemetry reference Copiar enlaceEnlace copiado en el portapapeles!
14.6.1. OpenTelemetry subsystem attributes Copiar enlaceEnlace copiado en el portapapeles!
You can modify opentelemetry subsystem attributes to configure its behavior. The attributes are grouped by the aspect they configure: exporter, sampler, and span processor.
| Attribute | Description | Default value |
|---|---|---|
|
| The URL to which OpenTelemetry pushes traces. Set this to the URL where your exporter listens. | |
|
| The exporter to which traces are sent. It can be one of the following:
|
|
| Attribute | Description | Default value |
|---|---|---|
|
|
The ratio of traces to export. The value must be between |
|
| Attribute | Description | Default value |
|---|---|---|
|
|
The interval in milliseconds between two consecutive exports by JBoss EAP. This attribute only takes effect if you set the attribute |
|
|
| The maximum amount of time in milliseconds to allow for an export to complete before being cancelled. |
|
|
|
The maximum number of traces that are published in each batch. This number should be should be lesser or equal to the value of |
|
|
|
The maximum number of traces to queue before exporting. If an application creates more traces, they are not recorded. This attribute only takes effect if you set the attribute |
|
|
| The type of span processor to use. The value can be one of the following:
|
|