How rafaelbergo/sistemasdistribuidos3 works
This repository implements a signed-message e-commerce system of .NET services. The main workflow accepts an order, checks product details through the inventory API, publishes the order event, reserves stock, and—when stock is available—starts payment processing; a webhook handles later payment updates. Separate catalog, promotions, delivery, and promotion-consumer applications are also present. The sampled files show the order, inventory, and payment paths; some other service behavior is known only from the source index, so those links are omitted where their runtime wiring is not evidenced.
Main entry points: EstoqueConsumerService.cs Inventory consumer · PagamentoConsumerService.cs Payment consumer · PedidosController.cs Order API · SignatureService.cs Signature service
Components 25
Order and catalog
- Order API
MS.Principal/Controllers/PedidosController.cs - Catalog API
MS.Principal/Controllers/CatalogoController.cs
Fulfillment services
- Inventory API
MS.Estoque/Controllers/ProdutosController.cs - Inventory consumer
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory manager
MS.Estoque/Services/EstoqueManager.cs - Payment consumer
MS.Pagamento/Services/PagamentoConsumerService.cs - Pending payments
MS.Pagamento/Services/PagamentoManager.cs - Payment webhook
MS.Pagamento/Controllers/WebhookController.cs - Delivery service
MS.Entrega/Program.cs
Shared messaging and security
- Order contracts
Foundation/Models/PedidoCriado.cs - Order request
Foundation/Models/PedidoRequest.cs - Catalog contracts
Foundation/Models/ProdutoCatalogoDto.cs - Stock records
Foundation/Models/ProdutoEstoque.cs - Promotion contract
Foundation/Models/Promocao.cs - Signed event publisher
Foundation/Services/RabbitMqPublisher.cs - Signed message envelope
Foundation/Message.cs - Signature service
Foundation/SignatureService.cs - Key management
Foundation/Keys/KeyManagement.cs - Key configuration
Foundation/Keys/KeyConfig.cs
Promotions
- Promotions service
MS.Promocoes/Program.cs - Promotion consumer C1
Consumidor.C1/Program.cs - Promotion consumer C2
Consumidor.C2/Program.cs
Other components
- Order client
- Mock payment API
- RabbitMQ
Connections 39
- Order client → Order API: submits order
MS.Principal/Controllers/PedidosController.cs - Order API → Order request: accepts
MS.Principal/Controllers/PedidosController.cs - Order API → Inventory API: checks products
MS.Principal/Controllers/PedidosController.cs - Order API → Catalog contracts: deserializes
MS.Principal/Controllers/PedidosController.cs - Order API → Order contracts: builds order
MS.Principal/Controllers/PedidosController.cs - Order API → Signed event publisher: publishes order
MS.Principal/Controllers/PedidosController.cs - Signed event publisher → Signature service: signs content
Foundation/Services/RabbitMqPublisher.cs - Signed event publisher → Key configuration: reads keys
Foundation/Services/RabbitMqPublisher.cs - Signed event publisher → Signed message envelope: wraps event
Foundation/Services/RabbitMqPublisher.cs - Signed event publisher → RabbitMQ: publishes event
Foundation/Services/RabbitMqPublisher.cs - Inventory API → Inventory manager: delegates lookup
MS.Estoque/Controllers/ProdutosController.cs - Inventory consumer → RabbitMQ: consumes orders
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → Signed message envelope: deserializes envelope
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → Order contracts: processes order
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → Signature service: verifies signature
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → Key configuration: reads key paths
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → Inventory manager: reserves stock
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory consumer → RabbitMQ: publishes stock result
MS.Estoque/Services/EstoqueConsumerService.cs - Inventory manager → Stock records: stores quantities
MS.Estoque/Services/EstoqueManager.cs - Payment consumer → RabbitMQ: consumes stock result
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Signed message envelope: deserializes envelope
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Order contracts: processes order
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Signature service: verifies signature
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Key configuration: reads key paths
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Pending payments: records pending order
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment consumer → Mock payment API: requests charge
MS.Pagamento/Services/PagamentoConsumerService.cs - Payment webhook → Pending payments: updates payment
MS.Pagamento/Controllers/WebhookController.cs - Payment webhook → Signed event publisher: publishes event
MS.Pagamento/Controllers/WebhookController.cs - Promotions service → Promotion contract: uses promotions
MS.Promocoes/Program.cs - Promotions service → Signed message envelope: uses envelope
MS.Promocoes/Program.cs - Promotions service → Signature service: uses signatures
MS.Promocoes/Program.cs - Promotion consumer C1 → Promotion contract: uses promotions
Consumidor.C1/Program.cs - Promotion consumer C1 → Signed message envelope: uses envelope
Consumidor.C1/Program.cs - Promotion consumer C1 → Signature service: verifies signatures
Consumidor.C1/Program.cs - Promotion consumer C2 → Promotion contract: uses promotions
Consumidor.C2/Program.cs - Promotion consumer C2 → Signed message envelope: uses envelope
Consumidor.C2/Program.cs - Promotion consumer C2 → Signature service: verifies signatures
Consumidor.C2/Program.cs - Key management → Signature service: supports key setup
- Delivery service → RabbitMQ: handles events