Skip to content

Add transaction management support for DelayHandler's schedule tasks [INT-2649] #6623

Closed

Activity

  1. spring-operator commented on Jul 9, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    Hi, all

    A little question about consistency: there is only one method (releaseMessage) in the DelayHandler which is invoked in the separate thread and which initiates followed message-flow via send Message into output-channel. So, only this method and his thread need to be wrapped with transaction.
    Will it be OK if we'll use here just TransactionTemplate around DelayHandler#releaseMessage instead of TransactionInterceptor and proxying of entire DelayHandler as it done for JpaOutboundGateway ?

  2. spring-operator commented on Jul 9, 2012

    @spring-operator
    ContributorAuthor

    Gary Russell commented

    Hi Artem, I was thinking the same thing.

    However, to be consistent with the poller, maybe we should support both <transactional/> and <advice-chain/> sub elements? (Mutually exclusive, of course).

  3. spring-operator commented on Jul 9, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    support both <transactional/> and <advice-chain/> sub elements

    H-m-m... Not sure that we really need some other aspects around only one DelayHandler#releaseMessage. By the way: there is only in the JPA module...
    And I also say more: there is no so much usage of with the <poller> on the practice.
    With SI-namespace we provide only limited set of methods to advising with the AOP. IMO: we should eliminate <advice-chain> at all to avoid some confusing configuration.

    With TransactionTemplate there is no so much changes, and for <advice-chain> we need introduce some DelayHandlerFactoryBean to write a code about proxying DelayHandler. But here I don't like to use default MatchAlwaysTransactionAttributeSource from IntegrationNamespaceUtils#configureTransactionAttributes: in this case all DelayHandler's methods will be advised, as it is done for JpaOutboundGateway.
    Or we need introduce some internal DelayHandler$DelayedMessageReleaser ;-).
    Or - create proxy for each Message...

    So, WDYT?

  4. spring-operator commented on Jul 10, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    So, I thought about this more and found that advice-chain and AOP-proxying for DelayHandler will be the best solution.
    I've linked the issue about RetryInterceptor because it is one more aspect which will be useful around Delayer's releaseMessage scheduled task.
    Now I change my mind and going to build some FactoryBean to proxying DelayHandler (or some internal releaseMessage task implementation) with advice-chain.
    Some note: to start the work I need your agreement ;-)

  5. spring-operator commented on Jul 11, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    Hi, Gary

    I've made some advice-chain implementation for DelayHandler without FactoryBean, so will it be OK if I make PR and we'll see what's going on together?
    In some places I've got doubts :-(

  6. spring-operator commented on Jul 11, 2012

    @spring-operator
    ContributorAuthor

    Gary Russell commented

    Hi Artem,

    We were just talking about this; we were thinking maybe just transactional is ok for now, and we can add advice chain later, if someone has a use case. However, if you have it already, go ahead and issue a PR and we can take a look.

  7. spring-operator commented on Jul 11, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    Thank you, guys, for your attention.
    Issue PR is here: #546

  8. spring-operator commented on Aug 7, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    Hi, Gary!
    Thank you for merging my PR, but I was changing my mind and was going to rework dalayer's 'advice-chain' ability according to your 'request-handler-advice-chain'.
    And also I was planing to remove <transactional> as you didn't provide it in the 'request-handler-advice-chain'.
    However If you think that my work OK with some your polishing, let it be.

    Now a little question: Does it make sense to mention this changes in the Manual and the Migration Guide?

    And my apologies that I stop contributing intensively.

  9. spring-operator commented on Aug 7, 2012

    @spring-operator
    ContributorAuthor

    Gary Russell commented

    Hi Artem,

    No; providing the ability to making the delayer's "dispatcher" thread transactional is completely orthogonal to the <request-handler-advice-chain/> implementation. If I had added that feature to the delayer, it would apply to the storing of the delayed message only, and nothing to do with dispatching the delayed message later.

    Also, the <request-handler-advice-chain /> is not intended to make the handleRequestMessage() transactional, it is to add advices such as expression evaluating (after success or failure) against the inbound message - such as to remove or move a file payload; circuit breaker advice; retry advice. Of course, someone could add a tx advice, but that is certainly not the intent of the feature.

    Note: I did not add <request-handler-advice-chain/> to the delayer; at the time, I didn't think it made sense. I suppose one could make an argument that a retry advice might be useful when using, say, a JDBC message store. If you think it's important, open a JIRA (or we can wait until someone asks for it). Note that, while merging, I changed your property to 'delayedAdviceChain' to avoid collision with the ARPMH superclass property (which is not currently exposed on the delay handler).

  10. spring-operator commented on Aug 7, 2012

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    OK, Gary.
    Thank you very much for your clarification.

    I agree with you that now <request-handler-advice-chain/> doesn't make sense to DelayHandler#handleRequestMessage().
    But who know what people will come up... Time will tell.

    Nevertheless we should keep in mind: now we "advice" the relaese message thread, but the last one invokes handleRequestMessage() in the end. And people may be a bit confused that message-flow has different behavior when Message is delayed and when not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions