Executive Summary
Each order create/update operation synchronously writes to the database, blocking the API response. Under load, response times degrade linearly.
Proposed Solution
@Service
public class OrderService {
@Async
@Transactional(propagation = Propagation.REQUIRES_NEW)
public CompletableFuture<Order> createOrderAsync(CreateOrderRequest request) {
return CompletableFuture.supplyAsync(() -> {
Order order = new Order(request);
Order saved = orderRepository.save(order);
orderEventPublisher.publishCreated(saved); // Async event
return saved;
});
}
}
// Controller returns immediately with order ID
@PostMapping("/orders")
public ResponseEntity<OrderResponse> createOrder(@RequestBody CreateOrderRequest req) {
Order order = new Order(req);
order.setStatus("PENDING");
orderRepository.save(order);
orderService.createOrderAsync(order); // Fire and forget
return ResponseEntity.status(201).body(new OrderResponse(order.getId()));
}
Checklist
@pooranjoyb Could you please /assign this issue to me? I would like to implement async order processing under NSOC '26.
/assign
Executive Summary
Each order create/update operation synchronously writes to the database, blocking the API response. Under load, response times degrade linearly.
Proposed Solution
Checklist
@pooranjoyb Could you please /assign this issue to me? I would like to implement async order processing under NSOC '26.
/assign