https://github.com/cheolwo/FullFillmentService/tree/main/FullFillMentSoulution/OrderServer
FullFillmentService/FullFillMentSoulution/OrderServer at main · cheolwo/FullFillmentService
FullFillmentService. Contribute to cheolwo/FullFillmentService development by creating an account on GitHub.
github.com
CQRS 라는 개발패턴으로 만들어봤어.
Front는 Blazor
BackEnd는 Asp.net Core Web API.
Front 이용 라이브러리
Back 이용 라이브러리
전체 프로젝트
도면에서 보이듯 충돌날까봐 EventQue는 Lock걸어서 접근해.
public Task EnqueueEventAsync(IEvent @event)
{
lock (_lock)
{
_eventQueue.Enqueue(@event);
if (@event is CreateOrderCommand createOrderCommand)
{
Console.WriteLine(createOrderCommand.Name);
}
}
return Task.CompletedTask;
}
public Task<IEvent> DequeueEventAsync()
{
lock (_lock)
{
if (_eventQueue.Count > 0)
{
return Task.FromResult(_eventQueue.Dequeue());
}
}
return Task.FromResult<IEvent>(null);
}
public async Task ProcessEventsAsync()
{
while (true)
{
IEvent @event;
lock (_lock)
{
if (_eventQueue.Count == 0)
{
break; // No events to process, exit the loop
}
@event = _eventQueue.Dequeue();
}
await ProcessEventAsync(@event);
}
}
EFCore 와 잘 연동되는 모습
My SQL 결과물
CQRS 개빡세구만...
개추
땡큐
나도 Blazor로 공부하는 중인데 외부 라이브러리 몇개 끼워서 게임 엔진처럼 써먹고 싶음. 좀 무리일려나?
아무래도 게임엔진은 그래픽 작업이 많다보니... 잘은 모르지만 Unity하는 게 좋을듯.
cqrs추
cqrs에 덤으로 마이크로서비스 예제 는 마소꺼 잘 만들어둔거 있음
https://github.com/dotnet-architecture/eShopOnContainers
- dc App
감사감사