To use vlingo-build-plugins
in your builds, simply add it as build plugin in your pom.xml
. The build tasks section below describes the supported goals and their configuration.
<project ...><build><plugins><plugin><groupId>io.vlingo</groupId><artifactId>vlingo-build-plugins</artifactId><version>1.1.0</version><executions>...</executions></plugin></plugins></build>...</project>
In case your project interacts with additional bounded contexts, you can use the VLINGO/SCHEMATA schema registry to publish and consume the exchanged types definitions. This implements the published language pattern using the registry as a broker to not only exchange type safe definitions but also the corresponding source code. For a detailed description of schema specifications and registry usage, see VLINGO/SCHEMATA.
Specifications of domain events published by your context should be kept along with it's source code. Consumed types should not be committed with your sources but rather generated on demand. This makes updating to new event versions easy and will trigger build warnings or errors if you're depending on a version that is unsafe to use, e.g. if it becomes deprecated
.
The push-schemata
and pull-schemata
goals of vlingo-build-plugins
allow for performing these tasks as part of your builds.
Both goals need to be configured with the URL of the VLINGO/SCHEMATA instance to push to and the client organisation and unit of the current project, e.g.
<configuration><schemataService><url>http://localhost:9019</url><clientOrganization>Vlingo</clientOrganization><clientUnit>examples</clientUnit></schemataService></configuration>
push-schemata
publishes schema specifications from your sources to the registry. By default, it binds to the install
lifecycle phase. The path to your specification files defaults to src/main/vlingo/schemata
and can be overridden by specifying configuration.srcDirectory
For each schema, you'll need to define:
Its reference consisting of the organisation, unit, context namespace, schema name and version, e.g. Vlingo:examples:io.vlingo.examples.schemata:SchemaDefined:1.0.1
The corresponding source file (optional, defaults to the <schema name from reference>.vss
)
The previous version of the schema in case you're updating an existing schema.
The following example configuration will push the schemas SchemaDefined v2.1.0
as an update to v2.0.4
and SchemaPublished v0.0.1
stored in src/main/vlingo
to the registry running on localhost:9019
when running mvn install
<build><plugins><plugin><groupId>io.vlingo</groupId><artifactId>vlingo-build-plugins</artifactId><version>1.1.0</version><executions><execution><goals><goal>push-schemata</goal></goals><configuration><srcDirectory>${basedir}/src/main/vlingo</srcDirectory><schemataService><url>http://localhost:9019</url><clientOrganization>Vlingo</clientOrganization><clientUnit>examples</clientUnit></schemataService><schemata><schema><ref>Vlingo:examples:io.vlingo.examples.schemata:SchemaDefined:2.1.0</ref><src>SchemaDefinedButWithACustomFileName.vss</src><previousVersion>2.0.4</previousVersion></schema><schema><ref>Vlingo:examples:io.vlingo.examples.schemata:SchemaPublished:0.0.1</ref></schema></schemata></configuration></execution></executions></plugin></plugins></build>
​
pull-schemata
retrieves code generated by the schema registry and puts it into thetarget/generated-sources/vlingo
output folder in the generate-sources
lifecycle phase by default. You can override this default by specifying configuration.outputDirectory
. The output folder is added to maven's compile path automatically. The specifications to pull are listed using their reference.
The following example will pull java code generated from the schemas defined in the previous section when running mvn generate-sources
.
<build><plugins><plugin><groupId>io.vlingo</groupId><artifactId>vlingo-build-plugins</artifactId><version>1.1.0</version><executions><execution><id>pullSchemata</id><goals><goal>pull-schemata</goal></goals><configuration><schemataService><url>http://localhost:9019</url><clientOrganization>Vlingo</clientOrganization><clientUnit>examples</clientUnit></schemataService><schemata><schema><ref>Vlingo:examples:io.vlingo.examples.schemata:SchemaDefined:2.1.0</ref></schema><schema><ref>Vlingo:examples:io.vlingo.examples.schemata:SchemaPublished:0.0.1</ref></schema></schemata></configuration></execution></executions></plugin></plugins></build>
Coming soon.