[JBoss JIRA] (JBTM-2458) Think of the possibility to improve Compensations API with lambdas
by Gytis Trikleris (JIRA)
[ https://issues.jboss.org/browse/JBTM-2458?page=com.atlassian.jira.plugin.... ]
Gytis Trikleris commented on JBTM-2458:
---------------------------------------
Example v3:
{code}
public interface Action {
void execute();
}
public interface CompensatableAction {
List<CompensationHandler> getCompensationHandlers();
List<ConfirmationHandler> getConfirmationHandlers();
List<TransactionLoggedHandler> getTransactionLoggedHandlers();
Action getAction();
}
public final class CompensatableActionBuilder() {
CompensatableActionBuilder addCompensationHandler(CompensationHandler compensationHandler);
CompensatableActionBuilder addConfirmationHandler(ConfirmationHandler confirmationHandler);
CompensatableActionBuilder addTransactionLoggedHandler(TransactionLoggedHandler transactionLoggedHandler);
CompensatableActionBuilder addAction(Action action);
CompensatableAction build();
}
tx.begin();
tx.enlist(compensatableAction);
tx.commit();
{code}
POC implementation of the example: https://github.com/gytis/narayana/commit/2ce55f2a40b1e8f1b0f7bc3c41e91e68...
> Think of the possibility to improve Compensations API with lambdas
> ------------------------------------------------------------------
>
> Key: JBTM-2458
> URL: https://issues.jboss.org/browse/JBTM-2458
> Project: JBoss Transaction Manager
> Issue Type: Task
> Components: TXFramework
> Reporter: Gytis Trikleris
> Assignee: Gytis Trikleris
> Priority: Minor
> Fix For: 5.next
>
>
> Emmanuel suggested to reduce verbosity in Compensations API by making it possible to use lambdas for handler implementation.
> We should try to think of the best API changes to introduce that.
> We could rewrite MongoDB quickstart to make it easier to visualise the difference.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)