I would like allow users to make periodic orders in an Ecommerce application, for example every week, every two weeks. I used the @Scheduled annotation, however, the annotated function cannot take arguments or have a return value.
Are there are any other alternatives or solutions to this issue?
@PostMapping(value="/period")
@Scheduled(fixedRate = 20000)
public ResponseEntity<Long> insertPeriodic(@Valid @RequestBody NewOrderDTO newOrderDTO){
Order order = orderService.insert(newOrderDTO);
URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(order.getId()).toUri();
return ResponseEntity.created(uri).body(order.getId());
}