Flume
  1. Flume
  2. FLUME-1176

Fan out and CBR should be refactored to be composite channels

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: v1.1.0
    • Fix Version/s: None
    • Component/s: Channel, Technical Debt
    • Labels:
      None

      Description

      I'd like to propose that ChannelProcessor and ChannelSelector go away in favor of a simplified composite channel based implementation.

      Today, fan out and content based routing (CBR, or technically header based routing) is implemented via the ChannelProcessor and ChannelSelector. While this works, it special cases these ideas. I propose we:

      • Create a Channel implementation called FanOutChannel that takes a list of Channels.
      • Its Transaction implementation simply delegates to the inner channel's transactions.
      • The semantics remain the same.

      In other words:

      class FanOutChannel:
        List<Channels> channels;
      
        getTx:
          tx = new FanOutTransaction()
          for ch in channels:
            txns.add(ch.getTx())
      
          return tx
      
      class FanOutTransaction implements Transaction:
        List<Transaction> txns;
      
        begin:
          for tx in txns:
            tx.begin()
      
        commit:
          for tx in txns:
            tx.commit()
        ...
      

      This preserves the semantics and drastically simplifies the code. The notion of required and optional channels are just conditions in the catch blocks within the composite Transaction impl (i.e. to rethrow or not to rethrow).

      This works for CBR and other composite cases.

        Activity

        E. Sammer made changes -
        Field Original Value New Value
        Description I'd like to propose that ChannelProcessor and ChannelSelector go away in favor of a simplified composite channel based implementation.

        Today, fan out and content based routing (CBR, or technically header based routing) is implemented via the ChannelProcessor and ChannelSelector. While this works, it special cases these ideas. I propose we:

        * Create a Channel implementation called FanOutChannel that takes a list of Channels.
        * Its Transaction implementation simply delegates to the inner channel's transactions.
        * The semantics remain the same.

        In other words:

        class FanOutChannel:
          List<Channels> channels;

          getTx:
            tx = new FanOutTransaction()
            for ch in channels:
              txns.add(ch.getTx())

            return tx

        class FanOutTransaction implements Transaction:
          List<Transaction> txns;

          begin:
            for tx in txns:
              tx.begin()

          commit:
            for tx in txns:
              tx.commit()
          ...

        This preserves the semantics and drastically simplifies the code. The notion of required and optional channels are just conditions in the catch blocks within the composite Transaction impl (i.e. to rethrow or not to rethrow).

        This works for CBR and other composite cases.
        I'd like to propose that ChannelProcessor and ChannelSelector go away in favor of a simplified composite channel based implementation.

        Today, fan out and content based routing (CBR, or technically header based routing) is implemented via the ChannelProcessor and ChannelSelector. While this works, it special cases these ideas. I propose we:

        * Create a Channel implementation called FanOutChannel that takes a list of Channels.
        * Its Transaction implementation simply delegates to the inner channel's transactions.
        * The semantics remain the same.

        In other words:

        {code}
        class FanOutChannel:
          List<Channels> channels;

          getTx:
            tx = new FanOutTransaction()
            for ch in channels:
              txns.add(ch.getTx())

            return tx

        class FanOutTransaction implements Transaction:
          List<Transaction> txns;

          begin:
            for tx in txns:
              tx.begin()

          commit:
            for tx in txns:
              tx.commit()
          ...
        {code}

        This preserves the semantics and drastically simplifies the code. The notion of required and optional channels are just conditions in the catch blocks within the composite Transaction impl (i.e. to rethrow or not to rethrow).

        This works for CBR and other composite cases.
        E. Sammer created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            E. Sammer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development