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.



0e8ce215a559d742e57602fb06df231d607789643c8d0ab45443



Front 이용 라이브러리

0bafdf28f192b45bba332c7c565ad9e19ea95de4b3db8ae8930139b46d7738045760d3592dae999640aa2b

Back 이용 라이브러리


0fbcd32dc0dc3c2a994f5a51ea91a8c09d657ebd7b45f39cbb017a202e66128bcd90043170cbf969ef29db532265cc5476499b225d08

전체 프로젝트



a04934ad242eb46693323c6d9c04e8b1a59be40fbe988734b8724540d219fca9ca


도면에서 보이듯 충돌날까봐 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 와 잘 연동되는 모습


0e8ce215a5f71e8561add3f53bc8170c564faff2363cce6dfef19cb483ee3cec


My SQL 결과물


0e8ce215a5fd2aa26bad9691349f34332b9205edbb051ba8b3f12294