@Test public void sendsTxStartedEventBefore() throws Exception { int retries = new Random().nextInt(); interceptor.preIntercept(parentTxId, compensationMethod, 0, retryMethod, retries, message); TxEvent event = messages.get(0); assertThat(event.globalTxId(), is(globalTxId)); assertThat(event.localTxId(), is(localTxId)); assertThat(event.parentTxId(), is(parentTxId)); assertThat(event.retries(), is(retries)); assertThat(event.retryMethod(), is(retryMethod)); assertThat(event.type(), is(EventType.TxStartedEvent)); assertThat(event.compensationMethod(), is(compensationMethod)); assertThat(asList(event.payloads()).contains(message), is(true)); }
@Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int retries, Object... message) { AlphaResponse response = sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, retries, context.category(), message)); readConfigFromServer(); return response; }
CompensableInterceptor implements EventAwareInterceptor { @Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int retries, Object... message) { AlphaResponse response = sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, retries, context.category(), message)); readConfigFromServer(); return response; } }
CompensableInterceptor implements EventAwareInterceptor { @Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int retries, Object... message) { AlphaResponse response = sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, retries, context.category(), message)); readConfigFromServer(); return response; } CompensableInterceptor(OmegaContext context, MessageSender sender); }
CompensableInterceptor implements EventAwareInterceptor { @Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int retries, Object... message) { AlphaResponse response = sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, retries, context.category(), message)); readConfigFromServer(); return response; } CompensableInterceptor(OmegaContext context, 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); }
CompensableInterceptor implements EventAwareInterceptor { @Override public AlphaResponse preIntercept(String parentTxId, String compensationMethod, int timeout, String retriesMethod, int retries, Object... message) { AlphaResponse response = sender.send(new TxStartedEvent(context.globalTxId(), context.localTxId(), parentTxId, compensationMethod, timeout, retriesMethod, retries, context.category(), message)); readConfigFromServer(); return response; } CompensableInterceptor(OmegaContext context, 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);  }