Skip to content

Commit 1a34d9c

Browse files
Merge pull request #20 from EventStore/subsystems
Add ISubsystemsPlugin as a way to plugably create subsystems
2 parents b791b81 + 31bc5b5 commit 1a34d9c

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.Extensions.DependencyInjection;
5+
6+
namespace EventStore.Plugins.Subsystems;
7+
8+
public interface ISubsystem {
9+
IApplicationBuilder Configure(IApplicationBuilder builder);
10+
IServiceCollection ConfigureServices(IServiceCollection services);
11+
IEnumerable<Task> Start();
12+
void Stop();
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace EventStore.Plugins.Subsystems;
2+
3+
public interface ISubsystemFactory<TArg> {
4+
ISubsystem Create(TArg arg);
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
3+
namespace EventStore.Plugins.Subsystems;
4+
5+
// A plugin that can create multiple subsystems.
6+
// A TArg is required to produce each subsystem from its respective factory.
7+
public interface ISubsystemsPlugin<TArg> {
8+
string Name { get; }
9+
string Version { get; }
10+
string CommandLineName { get; }
11+
IEnumerable<ISubsystemFactory<TArg>> GetSubsystemFactories(string configPath);
12+
}

0 commit comments

Comments
 (0)