I add an event, all good, see controller below…
I then read every 2 secs from a normal SELECT statement…
The SimpleCommandBus kicks in and dispatches the same command again and again and again…
Controller…
@Path("/lock/{sku}")
public Response lock(@PathParam("sku") String sku, @QueryParam("quantity") Integer quantity, @QueryParam("location") String location, @QueryParam("zone") String zone) {
LOGGER.info(String.format("Invoking Lock Update API %s", sku));
commandGateway.send(new GenericCommandMessage<>(new StockItemLockCommand(sku, quantity, new Location(location, zone))));
return Response.ok("Success").build();
}
Log.....
[http-nio-9093-exec-2] [INFO] [2018-01-25 18:52:03,185] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-3] [INFO] [2018-01-25 18:52:05,186] c.d.s.a.e.c.r.StockEventQueryController: Invoking Events Model API 3
[http-nio-9093-exec-3] [INFO] [2018-01-25 18:52:05,186] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-4] [INFO] [2018-01-25 18:52:07,186] c.d.s.a.e.c.r.StockEventQueryController: Invoking Events Model API 3
[http-nio-9093-exec-4] [INFO] [2018-01-25 18:52:07,186] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-5] [INFO] [2018-01-25 18:52:09,185] c.d.s.a.e.c.r.StockEventQueryController: Invoking Events Model API 3
[http-nio-9093-exec-5] [INFO] [2018-01-25 18:52:09,185] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-7] [INFO] [2018-01-25 18:52:11,186] c.d.s.a.e.c.r.StockEventQueryController: Invoking Events Model API 3
[http-nio-9093-exec-7] [INFO] [2018-01-25 18:52:11,186] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-6] [INFO] [2018-01-25 18:52:13,185] c.d.s.a.e.c.r.StockEventQueryController: Invoking Events Model API 3
[http-nio-9093-exec-6] [INFO] [2018-01-25 18:52:13,185] c.d.s.a.e.r.StockEventCassandraRepository: getEvents for Aggregate: 3 SeqNo: 0 BatchSize: 100
[http-nio-9093-exec-8] [DEBUG] [2018-01-25 18:52:13,379] o.a.c.SimpleCommandBus: Dispatching command [com.xxxxxxx.services.atp.model.command.StockItemLockCommand]
[http-nio-9093-exec-8] [DEBUG] [2018-01-25 18:52:13,379] o.a.m.u.AbstractUnitOfWork: Starting Unit Of Work
Do I need to clear the bus or someting?