@Test public void sendsSagaEndedEvent() { sagaStartAnnotationProcessor.postIntercept(null, null); TxEvent event = messages.get(0); assertThat(event.globalTxId(), is(globalTxId)); assertThat(event.localTxId(), is(globalTxId)); assertThat(event.parentTxId(), is(nullValue())); assertThat(event.compensationMethod().isEmpty(), is(true)); assertThat(event.type(), is(EventType.SagaEndedEvent)); assertThat(event.payloads().length, is(0)); }
@Override public void postIntercept(String parentTxId, String compensationMethod) { AlphaResponse response = sender.send(new SagaEndedEvent(omegaContext.globalTxId(), omegaContext.localTxId(), omegaContext.category())); if (response.aborted()) { throw new OmegaException("transaction " + parentTxId + " is aborted"); } }
SagaStartAnnotationProcessor implements EventAwareInterceptor { @Override public void postIntercept(String parentTxId, String compensationMethod) { AlphaResponse response = sender.send(new SagaEndedEvent(omegaContext.globalTxId(), omegaContext.localTxId(), omegaContext.category())); if (response.aborted()) { throw new OmegaException("transaction " + parentTxId + " is aborted"); } } }
SagaStartAnnotationProcessor implements EventAwareInterceptor { @Override public void postIntercept(String parentTxId, String compensationMethod) { AlphaResponse response = sender.send(new SagaEndedEvent(omegaContext.globalTxId(), omegaContext.localTxId(), omegaContext.category())); if (response.aborted()) { throw new OmegaException("transaction " + parentTxId + " is aborted"); } } SagaStartAnnotationProcessor(OmegaContext omegaContext, MessageSender sender); }
SagaStartAnnotationProcessor implements EventAwareInterceptor { @Override public void postIntercept(String parentTxId, String compensationMethod) { AlphaResponse response = sender.send(new SagaEndedEvent(omegaContext.globalTxId(), omegaContext.localTxId(), omegaContext.category())); if (response.aborted()) { throw new OmegaException("transaction " + parentTxId + " is aborted"); } } SagaStartAnnotationProcessor(OmegaContext omegaContext, MessageSender sender); @Override AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod,
      int retries, Object... message); @Override void postIntercept(String parentTxId, String compensationMethod); @Override void onError(String parentTxId, String compensationMethod, Throwable throwable); }
SagaStartAnnotationProcessor implements EventAwareInterceptor { @Override public void postIntercept(String parentTxId, String compensationMethod) { AlphaResponse response = sender.send(new SagaEndedEvent(omegaContext.globalTxId(), omegaContext.localTxId(), omegaContext.category())); if (response.aborted()) { throw new OmegaException("transaction " + parentTxId + " is aborted"); } } SagaStartAnnotationProcessor(OmegaContext omegaContext, MessageSender sender); @Override AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod,
      int retries, Object... message); @Override void postIntercept(String parentTxId, String compensationMethod); @Override void onError(String parentTxId, String compensationMethod, Throwable throwable);  }