@Test public void persistEventOnArrival() throws Exception { TxEvent[] events = { newEvent(SagaStartedEvent), newEvent(TxStartedEvent), newEvent(TxEndedEvent), newEvent(TxCompensatedEvent), newEvent(SagaEndedEvent)}; for (TxEvent event : events) { consistentService.handle(event); } assertThat(this.events, contains(events)); }
public boolean handle(TxEvent event) { return true; }
TxConsistentService { public boolean handle(TxEvent event) { return true; } }
TxConsistentService { public boolean handle(TxEvent event) { return true; } TxConsistentService(TxEventRepository eventRepository, CommandRepository commandRepository, TxTimeoutRepository timeoutRepository); }
TxConsistentService { public boolean handle(TxEvent event) { return true; } TxConsistentService(TxEventRepository eventRepository, CommandRepository commandRepository, TxTimeoutRepository timeoutRepository); boolean handle(TxEvent event); int handleSupportTxPause(TxEvent event); Set<String> fetchLocalTxIdOfEndedGlobalTx(Set<String> localTxIdSet); boolean saveKafkaMessage(KafkaMessage message); boolean registerGlobalTx(TxEvent event); boolean registerSubTx(TxEvent subTxEvent, TxEventAddition subTxEventAddition); boolean checkIsExistsEventType(String globalTxId, String localTxId, String type); }
TxConsistentService { public boolean handle(TxEvent event) { return true; } TxConsistentService(TxEventRepository eventRepository, CommandRepository commandRepository, TxTimeoutRepository timeoutRepository); boolean handle(TxEvent event); int handleSupportTxPause(TxEvent event); Set<String> fetchLocalTxIdOfEndedGlobalTx(Set<String> localTxIdSet); boolean saveKafkaMessage(KafkaMessage message); boolean registerGlobalTx(TxEvent event); boolean registerSubTx(TxEvent subTxEvent, TxEventAddition subTxEventAddition); boolean checkIsExistsEventType(String globalTxId, String localTxId, String type);  }