From 5ae7350b81dedc2483fa4a317b6376fd2eacec14 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Tue, 2 May 2017 09:40:00 +0200 Subject: [PATCH] CommandBus WIP --- .../CommandBus/CommandBus/CommandBus.csproj | 8 ++++++++ .../CommandBus/CommandBus/ICommandBus.cs | 13 +++++++++++++ .../CommandBus/IntegrationCommand.cs | 18 ++++++++++++++++++ .../CommandBusRabbitMQ.csproj | 7 +++++++ 4 files changed, 46 insertions(+) create mode 100644 src/BuildingBlocks/CommandBus/CommandBus/CommandBus.csproj create mode 100644 src/BuildingBlocks/CommandBus/CommandBus/ICommandBus.cs create mode 100644 src/BuildingBlocks/CommandBus/CommandBus/IntegrationCommand.cs create mode 100644 src/BuildingBlocks/CommandBus/CommandBusRabbitMQ/CommandBusRabbitMQ.csproj diff --git a/src/BuildingBlocks/CommandBus/CommandBus/CommandBus.csproj b/src/BuildingBlocks/CommandBus/CommandBus/CommandBus.csproj new file mode 100644 index 000000000..ae05359a1 --- /dev/null +++ b/src/BuildingBlocks/CommandBus/CommandBus/CommandBus.csproj @@ -0,0 +1,8 @@ + + + + netstandard1.4 + Microsoft.eShopOnContainers.BuildingBlocks.CommandBus + + + \ No newline at end of file diff --git a/src/BuildingBlocks/CommandBus/CommandBus/ICommandBus.cs b/src/BuildingBlocks/CommandBus/CommandBus/ICommandBus.cs new file mode 100644 index 000000000..2092e11b0 --- /dev/null +++ b/src/BuildingBlocks/CommandBus/CommandBus/ICommandBus.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.eShopOnContainers.BuildingBlocks.CommandBus +{ + public interface ICommandBus + { + Task SendAsync(T command) where T : IntegrationCommand; + + } +} diff --git a/src/BuildingBlocks/CommandBus/CommandBus/IntegrationCommand.cs b/src/BuildingBlocks/CommandBus/CommandBus/IntegrationCommand.cs new file mode 100644 index 000000000..36f1f0fdc --- /dev/null +++ b/src/BuildingBlocks/CommandBus/CommandBus/IntegrationCommand.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.eShopOnContainers.BuildingBlocks.CommandBus +{ + public abstract class IntegrationCommand + { + public Guid Id { get; private set; } + public DateTime Sent { get; private set; } + + protected IntegrationCommand() + { + Id = Guid.NewGuid(); + Sent = DateTime.UtcNow; + } + } +} diff --git a/src/BuildingBlocks/CommandBus/CommandBusRabbitMQ/CommandBusRabbitMQ.csproj b/src/BuildingBlocks/CommandBus/CommandBusRabbitMQ/CommandBusRabbitMQ.csproj new file mode 100644 index 000000000..954020d10 --- /dev/null +++ b/src/BuildingBlocks/CommandBus/CommandBusRabbitMQ/CommandBusRabbitMQ.csproj @@ -0,0 +1,7 @@ + + + + netstandard1.4 + + + \ No newline at end of file