2016-08-31 17:53:47 +00:00
|
|
|
[[_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.
|
|
|
|
|
2017-08-28 12:50:14 +00:00
|
|
|
{project_name} is a highly modular system that allows great
|
2016-08-31 17:53:47 +00:00
|
|
|
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]
|
|
|
|
----
|
2017-02-16 09:55:31 +00:00
|
|
|
<spi name="myspi">
|
|
|
|
<default-provider>myprovider</default-provider>
|
|
|
|
<provider name="myprovider" enabled="true">
|
2016-08-31 17:53:47 +00:00
|
|
|
<properties>
|
2017-02-16 09:55:31 +00:00
|
|
|
<property name="foo" value="bar"/>
|
2016-08-31 17:53:47 +00:00
|
|
|
</properties>
|
|
|
|
</provider>
|
2017-02-16 09:55:31 +00:00
|
|
|
<provider name="mysecondprovider" enabled="true">
|
2016-08-31 17:53:47 +00:00
|
|
|
<properties>
|
2017-02-16 09:55:31 +00:00
|
|
|
<property name="foo" value="foo"/>
|
2016-08-31 17:53:47 +00:00
|
|
|
</properties>
|
|
|
|
</provider>
|
|
|
|
</spi>
|
|
|
|
----
|
2017-02-16 09:55:31 +00:00
|
|
|
Here we have two providers defined for the SPI `myspi`. The `default-provider`
|
|
|
|
is listed as `myprovider`. However it is up to the SPI to decide how it will treat
|
2016-08-31 17:53:47 +00:00
|
|
|
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.
|
2017-02-16 09:55:31 +00:00
|
|
|
The fact that both providers above have a property called `foo` is just a
|
2016-08-31 17:53:47 +00:00
|
|
|
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="["EVENT1",
|
|
|
|
"EVENT2"]"/>
|
|
|
|
</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 `\"`.
|