Generic projection runner infrastructure.
Generic projection runner infrastructure.
class ProjectionContext : Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.RunnerDbContext<ProjectionContext> { ... }
class Projections : Be.Vlaanderen.Basisregisters.ProjectionHandling.Connector.ConnectedProjection<ProjectionContext> { ... }
class ProjectionContextMigrationHelper : RunnerDbContextMigrationHelper<ProjectionContext> {
public ProjectionContextMigrationHelper(
string connectionString,
ILoggerFactory loggerFactory)
: base(
connectionString,
new HistoryConfiguration
{
Schema = "MigrationsSchema",
Table = "MigrationTablesHistoryTable"
},
loggerFactory)
{ }
protected override ProjectionContext CreateContext(DbContextOptions<ExtractContext> migrationContextOptions)
{
return new ProjectionContext(migrationContextOptions);
}
}
Autofac.ContainerBuilder builder;
// Register Projector module
builder.RegisterModule<ProjectorModule>();
// Register migration helpers for a ProjectionContext
builder
.RegisterProjectionMigrator<ProjectionContextMigrationFactory>(configuration, loggerFactory);
// Register ConnectedProjections for a projection context
builder
.RegisterProjections<Projections, ProjectionContext>();
// Register ConnectedProjections that require initialisation parameters
builder
.RegisterProjections<Projections, ProjectionContext>(
() => new Projections(parameter1, parameter2, ...)
);
// Register ConnectedProjections that require initialisation parameters and/or automically resolved dependencies
builder
.RegisterProjections<Projections, ProjectionContext>(
container => new Projections(parameter1, container.Resolve<TDependency>(), ...)
);
IConnectedProjectionsManager projectionManager;
// Status of registered projections
var projectsStatus = projectionManager.GetRegisteredProjections();
// Start all registered projections
projectionManager.Start();
// Start a specific projection by id
projectionManager.Start(projection);
// Stop all registered projections
projectionManager.Stop();
// Stop a specific projection by id
projectionManager.Stop(projection);
Inherit Controller from DefaultProjectionContoller
[ApiRoute("controller-path")]
public class ProjectionsController : DefaultProjectorController
{
public ProjectionsController(IConnectedProjectionsManager connectedProjectionsManager)
: base(connectedProjectionsManager)
{ }
}
Status of registered projections: [GET] https://projector.url/controller-path/
Start all registered projections: [POST] https://projector.url/controller-path/start/all
Start a specific projection by id: [POST] https://projector.url/controller-path/start/{projection}
Stop all registered projections: [POST] https://projector.url/controller-path/stop/all
Stop a specific projection by id: [POST] https://projector.url/controller-path/stop/{projection}
build.cmd
or build.sh
.build.cmd
or build.sh
to make sure everything still compiles and all tests are still passing../dist
which you can then test with locally, to ensure the bug or feature has been successfully implemented.TODO: More to come :)
Our build.sh
script knows a few tricks. By default it runs with the Test
target.
The buildserver passes in BITBUCKET_BUILD_NUMBER
as an integer to version the results and BUILD_DOCKER_REGISTRY
to point to a Docker registry to push the resulting Docker images.
Run an npm install
to setup Commitizen and Semantic Release.
Checks if the requested .NET Core SDK and runtime version defined in global.json
are available.
We are pedantic about these being the exact versions to have identical builds everywhere.
Make sure we have a clean build directory to start with.
Restore dependencies for debian.8-x64
and win10-x64
using dotnet restore and Paket.
Builds the solution in Release mode with the .NET Core SDK and runtime specified in global.json
It builds it platform-neutral, debian.8-x64
and win10-x64
version.
Runs dotnet test
against the test projects.
Runs a dotnet publish
for the debian.8-x64
and win10-x64
version as a self-contained application.
It does this using the Release configuration.
Packs the solution using Paket in Release mode and places the result in the dist
folder.
This is usually used to build documentation NuGet packages.