Spring Integration
  1. Spring Integration
  2. INT-3023

Add XML namespace parser support for an inbound-channel-adapter at the beginning of a chain

    Details

      Description

      When an inbound-channel-adaptor feeds into a chain, it would be convenient and intuitive if the connecting channel could be inferred the same way as it is between the MessageHandlers in the chain.

      In this example, the channel attributes are just wiring. They contribute little to the meaning of the flow, and the developer is forced to come up with a unique channel name. In larger configurations, this is tedious and pollutes the channel namespace.

      <int-http:inbound-channel-adapter channel="channel1" ... />
      
      <int:chain input-channel="channel1">
        <int:service-activator ... />
        ...
      </int:chain>
      

      In this hypothetical example, the adapter is moved to the top of the chain, and the channel configuration is made implicit. With a message source at the top of the chain, the processing flow remains clear. Under the hood, there is still a direct channel between the adapter and the chain, but the developer doesn't have to name it.

      <int:chain>
        <int-http:inbound-channel-adapter ... />
        <int:service-activator ... />
        ...
      </int:chain>
      

      And, in cases where explicit channel configuration is desired, it would still be convenient to be able to nest the adapter in the channel and infer its channel attribute.

      <int:channel id="someChannel" />
      
      <int:chain input-channel="someChannel">
        <int-http:inbound-channel-adapter ... />
        <int:service-activator ... />
        ...
      </int:chain>
      

      A chain as presently implemented in Spring Integration is technically a sequence of MessageHandlers, and this feature would admittedly muddy that definition. However, syntactically, <int:chain /> is clearly a grouping mechanism, and it would be convenient and intuitive to be able to nest all participating elements inside the same tag. This boils down to syntactic sugar, but when placed adjacent to a chain with its clean, implicit channel wiring, the channel boilerplate currently required for inbound adapters is fairly conspicuous and distracting.

        Activity

        Hide
        Nathan Williams added a comment -

        I did some exploratory work on this and would be willing to try to flesh it out, but as a new contributor (I did submit a CLA) I'd appreciate feedback on whether such an implementation approach (or the feature itself) would be worth pursuing before continuing more formally. See https://gist.github.com/nlwillia/5602964 for now. The syntactic gymnastics seem like they could be contained to the ChainParser itself, though there may be better approaches. (This is my first exposure to the internals, and I'm sure it shows.) The schema allows xsd:any in a chain, so there's no complaint in the editor about adding inbound adapter elements inside.

        Show
        Nathan Williams added a comment - I did some exploratory work on this and would be willing to try to flesh it out, but as a new contributor (I did submit a CLA) I'd appreciate feedback on whether such an implementation approach (or the feature itself) would be worth pursuing before continuing more formally. See https://gist.github.com/nlwillia/5602964 for now. The syntactic gymnastics seem like they could be contained to the ChainParser itself, though there may be better approaches. (This is my first exposure to the internals, and I'm sure it shows.) The schema allows xsd:any in a chain, so there's no complaint in the editor about adding inbound adapter elements inside.
        Hide
        Nathan Williams added a comment -

        Strike the second suggestion that a nested inbound-channel-adapter take its channel from a declared input-channel of the chain. It's most consistent to correlate the chain's channel attributes with the type of endpoint sequence it contains.

        Show
        Nathan Williams added a comment - Strike the second suggestion that a nested inbound-channel-adapter take its channel from a declared input-channel of the chain. It's most consistent to correlate the chain's channel attributes with the type of endpoint sequence it contains.

          People

          • Assignee:
            Artem Bilan
            Reporter:
            Nathan Williams
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: