Camel
  1. Camel
  2. CAMEL-2729

Enable transaction propagation for SEDA component

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.0
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      I was recently working on a pure SEDA prototype based on Camel and ActiveMQ, and the biggest problem I had was the lack of transaction propagation among stages/threads, due to the Spring transaction-per-thread model which Camel relies on.
      Hence, it is currently impossible to commit/rollback transactions from a different stage than the one that initiated it.

      So, I developed a patch to org.apache.camel.component.jms.JmsConfiguration class in order to use a custom org.springframework.jms.listener.AbstractMessageListenerContainer which enables external transaction management.
      Then, I developed a Camel bean component to bind and propagate transactional resources among threads, and manually commit/rollback transactions.
      I'm attaching a sample project containing and showcasing all this stuff: it reads from an ActiveMQ queue, does dummy processing, and puts on another queue.
      In order to run:
      $> mvn test
      In order to run with an injected fault and do rollback:
      $> mvn test -Pfault-test
      WARN: requires a local ActiveMQ broker at tcp://localhost:61616

      I'd like to gain some feedback and eventually talk about including such a features into Camel code base, which would require to:
      1) Patch JmsConfiguration in order to allow injection of external AbstractMessageListenerContainer implementations.
      2) Patch JmsConfiguration in order to avoid forcing to set the TransactionManager.
      3) Somewhat enrich the Seda component to natively support transaction propagation.

      Feel free to ask any question, and thanks for listening!

      1. seda-camel.zip
        601 kB
        Sergio Bossa

        Activity

        Hide
        Claus Ibsen added a comment -

        Good timing on this one. We look into asynchronous for Camel 2.4, and having a way of doing transaction over async is really cool, which originates from a JMS queue.

        Show
        Claus Ibsen added a comment - Good timing on this one. We look into asynchronous for Camel 2.4, and having a way of doing transaction over async is really cool, which originates from a JMS queue.
        Hide
        Sergio Bossa added a comment -

        Thanks Claus. Let me know if I can help with integrating my work into Camel core.

        Show
        Sergio Bossa added a comment - Thanks Claus. Let me know if I can help with integrating my work into Camel core.
        Hide
        Claus Ibsen added a comment -

        Support for asynchronous transaction is on the roadmap for Camel 3.0 as being a new supported feature.

        Camel 2.5 is being scoped as bugfix and minor enhancements release.

        Show
        Claus Ibsen added a comment - Support for asynchronous transaction is on the roadmap for Camel 3.0 as being a new supported feature. Camel 2.5 is being scoped as bugfix and minor enhancements release.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sergio Bossa
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development