Merge pull request #104 from dotnet-architecture/dev
update to latest commit
This commit is contained in:
commit
abd96d2a73
69
README.md
69
README.md
@ -5,66 +5,21 @@ Sample .NET Core reference application, powered by Microsoft, based on a simplif
|
|||||||
|
|
||||||
Dev branch contains the latest "stable" code, and their images are tagged with `:dev` in our [Docker Hub](https://cloud.docker.com/u/eshop/repository/list):
|
Dev branch contains the latest "stable" code, and their images are tagged with `:dev` in our [Docker Hub](https://cloud.docker.com/u/eshop/repository/list):
|
||||||
|
|
||||||
Api Gateways base image
|
| Basket API | Catalog API | Identity API | Location API |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=199&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=197&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=200&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=202&branchName=dev) |
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=201&branchName=dev)
|
| Marketing API | Ordering API | Payment API | Api Gateways base image |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
|
| [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=203&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=198&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=205&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=201&branchName=dev)
|
||||||
|
|
||||||
Basket API
|
| Web Shopping Aggregator | Mobile Shopping Aggregator | WebMVC Client | WebSPA Client |
|
||||||
|
| ------------- | ------------- | ------------- | ------------- |
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=199&branchName=dev)
|
| [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=206&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=204&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=209&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=210&branchName=dev) |
|
||||||
|
|
||||||
Catalog API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=197&branchName=dev)
|
|
||||||
|
|
||||||
Identity API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=200&branchName=dev)
|
|
||||||
|
|
||||||
Location API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=202&branchName=dev)
|
|
||||||
|
|
||||||
Marketing API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=203&branchName=dev)
|
|
||||||
|
|
||||||
Ordering API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=198&branchName=dev)
|
|
||||||
|
|
||||||
Payment API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=205&branchName=dev)
|
|
||||||
|
|
||||||
Webhooks API
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=207&branchName=dev)
|
|
||||||
|
|
||||||
Web Shopping Aggregator
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=206&branchName=dev)
|
|
||||||
|
|
||||||
Mobile Shopping Aggregator
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=204&branchName=dev)
|
|
||||||
|
|
||||||
Webbhooks demo client
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=208&branchName=dev)
|
|
||||||
|
|
||||||
WebMVC Client
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=209&branchName=dev)
|
|
||||||
|
|
||||||
WebSPA Client
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=210&branchName=dev)
|
|
||||||
|
|
||||||
Web Status
|
|
||||||
|
|
||||||
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=211&branchName=dev)
|
|
||||||
|
|
||||||
|
| Web Status | Webhooks API | Webbhooks demo client |
|
||||||
|
| ------------- | ------------- | ------------- |
|
||||||
|
[](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=211&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=207&branchName=dev) | [](https://msftdevtools.visualstudio.com/eShopOnContainers/_build/latest?definitionId=208&branchName=dev) |
|
||||||
|
|
||||||
## IMPORTANT NOTES!
|
## IMPORTANT NOTES!
|
||||||
**You can use either the latest version of Visual Studio or simply Docker CLI and .NET CLI for Windows, Mac and Linux**.
|
**You can use either the latest version of Visual Studio or simply Docker CLI and .NET CLI for Windows, Mac and Linux**.
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
pool:
|
|
||||||
vmImage: 'ubuntu-16.04'
|
|
||||||
variables:
|
variables:
|
||||||
registryEndpoint: eshop-registry
|
registryEndpoint: eshop-registry
|
||||||
trigger:
|
trigger:
|
||||||
@ -17,8 +15,12 @@ trigger:
|
|||||||
exclude:
|
exclude:
|
||||||
- src/ApiGateways/Mobile.Bff.Shopping/aggregator/*
|
- src/ApiGateways/Mobile.Bff.Shopping/aggregator/*
|
||||||
- src/ApiGateways/Web.Bff.Shopping/aggregator/*
|
- src/ApiGateways/Web.Bff.Shopping/aggregator/*
|
||||||
steps:
|
jobs:
|
||||||
- task: DockerCompose@0
|
- job: BuildLinux
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-16.04'
|
||||||
|
steps:
|
||||||
|
- task: DockerCompose@0
|
||||||
displayName: Compose build apigws
|
displayName: Compose build apigws
|
||||||
inputs:
|
inputs:
|
||||||
dockerComposeCommand: 'build mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
dockerComposeCommand: 'build mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
||||||
@ -29,7 +31,7 @@ steps:
|
|||||||
projectName: ""
|
projectName: ""
|
||||||
dockerComposeFileArgs: |
|
dockerComposeFileArgs: |
|
||||||
TAG=$(Build.SourceBranchName)
|
TAG=$(Build.SourceBranchName)
|
||||||
- task: DockerCompose@0
|
- task: DockerCompose@0
|
||||||
displayName: Compose push apigws
|
displayName: Compose push apigws
|
||||||
inputs:
|
inputs:
|
||||||
dockerComposeCommand: 'push mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
dockerComposeCommand: 'push mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
||||||
@ -40,11 +42,39 @@ steps:
|
|||||||
projectName: ""
|
projectName: ""
|
||||||
dockerComposeFileArgs: |
|
dockerComposeFileArgs: |
|
||||||
TAG=$(Build.SourceBranchName)
|
TAG=$(Build.SourceBranchName)
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
inputs:
|
inputs:
|
||||||
sourceFolder: $(Build.SourcesDirectory)/k8s/helm
|
sourceFolder: $(Build.SourcesDirectory)/k8s/helm
|
||||||
targetFolder: $(Build.ArtifactStagingDirectory)/k8s/helm
|
targetFolder: $(Build.ArtifactStagingDirectory)/k8s/helm
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
inputs:
|
inputs:
|
||||||
pathtoPublish: $(Build.ArtifactStagingDirectory)/k8s/helm
|
pathtoPublish: $(Build.ArtifactStagingDirectory)/k8s/helm
|
||||||
artifactName: helm
|
artifactName: helm
|
||||||
|
- job: BuildWindows
|
||||||
|
pool:
|
||||||
|
vmImage: 'vs2017-win2016'
|
||||||
|
steps:
|
||||||
|
- task: DockerCompose@0
|
||||||
|
displayName: Compose build apigws
|
||||||
|
inputs:
|
||||||
|
dockerComposeCommand: 'build mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
||||||
|
containerregistrytype: Container Registry
|
||||||
|
dockerRegistryEndpoint: $(registryEndpoint)
|
||||||
|
dockerComposeFile: docker-compose.yml
|
||||||
|
qualifyImageNames: true
|
||||||
|
projectName: ""
|
||||||
|
dockerComposeFileArgs: |
|
||||||
|
TAG=$(Build.SourceBranchName)
|
||||||
|
PLATFORM=win
|
||||||
|
- task: DockerCompose@0
|
||||||
|
displayName: Compose push apigws
|
||||||
|
inputs:
|
||||||
|
dockerComposeCommand: 'push mobileshoppingapigw mobilemarketingapigw webshoppingapigw webmarketingapigw'
|
||||||
|
containerregistrytype: Container Registry
|
||||||
|
dockerRegistryEndpoint: $(registryEndpoint)
|
||||||
|
dockerComposeFile: docker-compose.yml
|
||||||
|
qualifyImageNames: true
|
||||||
|
projectName: ""
|
||||||
|
dockerComposeFileArgs: |
|
||||||
|
TAG=$(Build.SourceBranchName)
|
||||||
|
PLATFORM=win
|
@ -178,27 +178,46 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
|
|||||||
{
|
{
|
||||||
if (_consumerChannel != null)
|
if (_consumerChannel != null)
|
||||||
{
|
{
|
||||||
var consumer = new EventingBasicConsumer(_consumerChannel);
|
var consumer = new AsyncEventingBasicConsumer(_consumerChannel);
|
||||||
consumer.Received += async (model, ea) =>
|
|
||||||
{
|
|
||||||
var eventName = ea.RoutingKey;
|
|
||||||
var message = Encoding.UTF8.GetString(ea.Body);
|
|
||||||
|
|
||||||
await ProcessEvent(eventName, message);
|
consumer.Received += Consumer_Received;
|
||||||
|
|
||||||
_consumerChannel.BasicAck(ea.DeliveryTag, multiple: false);
|
_consumerChannel.BasicConsume(
|
||||||
};
|
queue: _queueName,
|
||||||
|
|
||||||
_consumerChannel.BasicConsume(queue: _queueName,
|
|
||||||
autoAck: false,
|
autoAck: false,
|
||||||
consumer: consumer);
|
consumer: consumer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogError("StartBasicConsume can not call on _consumerChannelCreated == false");
|
_logger.LogError("StartBasicConsume can't call on _consumerChannel == null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Consumer_Received(object sender, BasicDeliverEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
var eventName = eventArgs.RoutingKey;
|
||||||
|
var message = Encoding.UTF8.GetString(eventArgs.Body);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (message.ToLowerInvariant().Contains("throw-fake-exception"))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Fake exception requested: \"{message}\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
await ProcessEvent(eventName, message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "----- ERROR Processing message \"{Message}\"", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Even on exception we take the message off the queue.
|
||||||
|
// in a REAL WORLD app this should be handled with a Dead Letter Exchange (DLX).
|
||||||
|
// For more information see: https://www.rabbitmq.com/dlx.html
|
||||||
|
_consumerChannel.BasicAck(eventArgs.DeliveryTag, multiple: false);
|
||||||
|
}
|
||||||
|
|
||||||
private IModel CreateConsumerChannel()
|
private IModel CreateConsumerChannel()
|
||||||
{
|
{
|
||||||
if (!_persistentConnection.IsConnected)
|
if (!_persistentConnection.IsConnected)
|
||||||
|
@ -105,7 +105,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -64,7 +64,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model
|
|||||||
|
|
||||||
if (quantityDesired <= 0)
|
if (quantityDesired <= 0)
|
||||||
{
|
{
|
||||||
throw new CatalogDomainException($"Item units desired should be greater than cero");
|
throw new CatalogDomainException($"Item units desired should be greater than zero");
|
||||||
}
|
}
|
||||||
|
|
||||||
int removed = Math.Min(quantityDesired, this.AvailableStock);
|
int removed = Math.Min(quantityDesired, this.AvailableStock);
|
||||||
|
@ -297,7 +297,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = configuration["EventBusConnection"]
|
HostName = configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
||||||
|
@ -77,7 +77,8 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -101,7 +101,8 @@
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -305,7 +305,8 @@
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = configuration["EventBusConnection"]
|
HostName = configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
||||||
|
@ -68,7 +68,8 @@ namespace Ordering.BackgroundTasks
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -132,7 +132,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
|||||||
AddDomainEvent(new OrderStatusChangedToPaidDomainEvent(Id, OrderItems));
|
AddDomainEvent(new OrderStatusChangedToPaidDomainEvent(Id, OrderItems));
|
||||||
|
|
||||||
_orderStatusId = OrderStatus.Paid.Id;
|
_orderStatusId = OrderStatus.Paid.Id;
|
||||||
_description = "The payment was performed at a simulated \"American Bank checking bank account endinf on XX35071\"";
|
_description = "The payment was performed at a simulated \"American Bank checking bank account ending on XX35071\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,8 @@ namespace Ordering.SignalrHub
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -58,7 +58,8 @@ namespace Payment.API
|
|||||||
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = Configuration["EventBusConnection"]
|
HostName = Configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
|
||||||
|
@ -320,7 +320,8 @@ namespace Webhooks.API
|
|||||||
|
|
||||||
var factory = new ConnectionFactory()
|
var factory = new ConnectionFactory()
|
||||||
{
|
{
|
||||||
HostName = configuration["EventBusConnection"]
|
HostName = configuration["EventBusConnection"],
|
||||||
|
DispatchConsumersAsync = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
if (!string.IsNullOrEmpty(configuration["EventBusUserName"]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user