keycloak-scim/server_installation/topics/config-subsystem/configure-spi-providers.adoc

59 lines
2.4 KiB
Text
Raw Normal View History

[[_config_spi_providers]]
=== Configure SPI Providers
The specifics of each configuration setting is discussed elsewhere in
context with that setting. However, it is useful to understand the format used
to declare settings on SPI providers.
{{book.project.name}} is a highly modular system that allows great
flexibility. There are more than 50 service provider interfaces (SPIs), and
you are allowed to swap out implementations of each SPI. An implementation of
an SPI is known as a _provider_.
All elements in an SPI declaration are optional, but a full SPI declaration
looks like this:
[source,xml]
----
<spi name="dblock">
<default-provider>mongo</default-provider>
<provider name="jpa" enabled="true">
<properties>
<property name="lockWaitTimeout" value="800"/>
</properties>
</provider>
<provider name="mongo" enabled="true">
<properties>
<property name="lockRecheckTime" value="2"/>
<property name="lockWaitTimeout" value="600"/>
</properties>
</provider>
</spi>
----
Here we have two providers defined for the SPI `dblock`. The `default-provider`
is listed as `mongo`. However it is up to the SPI to decide how it will treat
this setting. Some SPIs allow more than one provider and some do not. So
`default-provider` can help the SPI to choose.
Also notice that each provider defines its own set of configuration properties.
The fact that both providers above have a property called `lockWaitTimeout` is just a
coincidence.
The type of each property value is interpreted by the provider. However, there
is one exception. Consider the `jpa` provider for the `eventStore` API:
[source,xml]
----
<spi name="eventsStore">
<provider name="jpa" enabled="true">
<properties>
<property name="exclude-events" value="[&quot;EVENT1&quot;,
&quot;EVENT2&quot;]"/>
</properties>
</provider>
</spi>
----
We see that the value begins and ends with square brackets. That means that
the value will be passed to the provider as a list. In this example, the system will pass the
provider a list with two element values _EVENT1_ and _EVENT2_. To add more values
to the list, just separate each list element with a comma. Unfortunately,
you do need to escape the quotes surrounding each list element with `\&quot;`.