Merge branch 'dev' of https://github.com/dotnet-architecture/eShopOnContainers into dev
This commit is contained in:
commit
21dbb98c4a
2
.gitignore
vendored
2
.gitignore
vendored
@ -269,4 +269,4 @@ pub/
|
|||||||
.mfractor
|
.mfractor
|
||||||
|
|
||||||
# Ignore HealthCheckdb
|
# Ignore HealthCheckdb
|
||||||
*healthchecksdb*
|
*healthchecksdb*
|
||||||
|
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**.
|
||||||
|
@ -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,
|
||||||
|
autoAck: false,
|
||||||
_consumerChannel.BasicConsume(queue: _queueName,
|
consumer: consumer);
|
||||||
autoAck: false,
|
|
||||||
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)
|
||||||
@ -209,7 +228,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
|
|||||||
var channel = _persistentConnection.CreateModel();
|
var channel = _persistentConnection.CreateModel();
|
||||||
|
|
||||||
channel.ExchangeDeclare(exchange: BROKER_NAME,
|
channel.ExchangeDeclare(exchange: BROKER_NAME,
|
||||||
type: "direct");
|
type: "direct");
|
||||||
|
|
||||||
channel.QueueDeclare(queue: _queueName,
|
channel.QueueDeclare(queue: _queueName,
|
||||||
durable: true,
|
durable: true,
|
||||||
|
@ -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"]))
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
Sample reference containerized application, cross-platform and microservices architecture.
|
Sample reference containerized application, cross-platform and microservices architecture.
|
||||||
Powered by Microsoft
|
Powered by Microsoft
|
||||||
|
|
||||||
#Overview
|
## Overview
|
||||||
This sample runs a microservices oriented application and a .net core Mvc application that consumes this services. You can find more information about how to set up docker in your machine in the global directory solution.
|
This sample runs a microservices oriented application and a .net core Mvc application that consumes this services. You can find more information about how to set up docker in your machine in the global directory solution.
|
||||||
|
|
||||||
#Setup
|
## Setup
|
||||||
This service is a identity provider or STS (Security Token Service) currently implemented with IdentityServer 4 wrapping ASP.NET Identity underneath.
|
This service is a identity provider or STS (Security Token Service) currently implemented with IdentityServer 4 wrapping ASP.NET Identity underneath.
|
||||||
|
|
||||||
Check procedures on how to get the sample app started at the Wiki:
|
Check procedures on how to get the sample app started at the Wiki:
|
||||||
|
@ -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"]))
|
||||||
|
@ -105,6 +105,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//Todo: It's good idea to take advantage of GetOrderByIdQuery and handle by GetCustomerByIdQueryHandler
|
||||||
|
//var order customer = await _mediator.Send(new GetOrderByIdQuery(orderId));
|
||||||
var order = await _orderQueries.GetOrderAsync(orderId);
|
var order = await _orderQueries.GetOrderAsync(orderId);
|
||||||
|
|
||||||
return Ok(order);
|
return Ok(order);
|
||||||
@ -149,4 +151,4 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
|||||||
return await _mediator.Send(createOrderDraftCommand);
|
return await _mediator.Send(createOrderDraftCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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