use of org.mule.runtime.module.extension.internal.runtime.transaction.ExtensionTransactionKey in project mule by mulesoft.
the class ExtensionConnectionSupplier method getTransactedConnectionHandler.
private <T extends TransactionalConnection> ConnectionHandler<T> getTransactedConnectionHandler(ExecutionContextAdapter<? extends ComponentModel> executionContext, TransactionConfig transactionConfig) throws ConnectionException, TransactionException {
if (!transactionConfig.isTransacted()) {
return getTransactionlessConnectionHandler(executionContext);
}
ExtensionModel extensionModel = executionContext.getExtensionModel();
ComponentModel componentModel = executionContext.getComponentModel();
ConfigurationInstance configuration = executionContext.getConfiguration().orElseThrow(() -> new IllegalStateException(format("%s '%s' of extension '%s' cannot participate in a transaction because it doesn't have a config", getComponentModelTypeName(componentModel), componentModel.getName(), extensionModel.getName())));
final ExtensionTransactionKey txKey = new ExtensionTransactionKey(configuration);
TransactionBindingDelegate transactionBindingDelegate = new TransactionBindingDelegate(extensionModel, componentModel);
return transactionBindingDelegate.getBoundResource(transactionConfig, txKey, () -> getTransactionlessConnectionHandler(executionContext));
}
Aggregations