use of org.mule.test.transactional.connection.TestTransactionalConnection in project mule by mulesoft.
the class TransactionalSource method onStart.
@Override
public void onStart(SourceCallback<TestTransactionalConnection, Object> sourceCallback) throws MuleException {
connectExecutor = newFixedThreadPool(1);
connectExecutor.execute(() -> {
SourceCallbackContext ctx = sourceCallback.createContext();
try {
TestTransactionalConnection connection = connectionProvider.connect();
boolean isXa = false;
if (connection instanceof XATransactionalConnection) {
isXa = true;
xaResource = (DummyXaResource) ((XATransactionalConnection) connection).getXAResource();
}
ctx.addVariable(IS_XA, isXa);
ctx.bindConnection(connection);
sourceCallback.handle(Result.<TestTransactionalConnection, Object>builder().output(connection).build(), ctx);
} catch (ConnectionException e) {
sourceCallback.onConnectionException(e);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
Aggregations