Create new message chain out of existing channels












3















I wish to create a message chain out of existing channels, without specifically write all the elements again.



Currently I have several long chains that overlaps one another with certain elements. Every time I add a new element, I have to add it in several chains. I wish to create a chain of channels, that can be called as a sequence.



To simplify, my applicationContext at the moment has 3 channels. channel 1 and channel 2, and channel 3 that consist of the two:



<int:chain input-channel="channel-1">
<int:service-activator ref="serviceA" method="doService" />
<int:service-activator ref="serviceB" method="doService" />
<int:service-activator ref="serviceC" method="doService" />
</int:chain>

<int:chain input-channel="channel-2">
<int:service-activator ref="serviceD" method="doService" />
<int:service-activator ref="serviceE" method="doService" />
<int:service-activator ref="serviceF" method="doService" />
</int:chain>

<int:chain input-channel="channel-3">
<int:service-activator ref="serviceA" method="doService" />
<int:service-activator ref="serviceB" method="doService" />
<int:service-activator ref="serviceC" method="doService" />
<int:service-activator ref="serviceD" method="doService" />
<int:service-activator ref="serviceE" method="doService" />
<int:service-activator ref="serviceF" method="doService" />
</int:chain>


What I looking for is a simple solution that will enable me to do something like



<int:chain input-channel="channel-3">
<??? channel-1 />
<??? channel-2 />
</int:chain>


Is there some simple way to do that?










share|improve this question





























    3















    I wish to create a message chain out of existing channels, without specifically write all the elements again.



    Currently I have several long chains that overlaps one another with certain elements. Every time I add a new element, I have to add it in several chains. I wish to create a chain of channels, that can be called as a sequence.



    To simplify, my applicationContext at the moment has 3 channels. channel 1 and channel 2, and channel 3 that consist of the two:



    <int:chain input-channel="channel-1">
    <int:service-activator ref="serviceA" method="doService" />
    <int:service-activator ref="serviceB" method="doService" />
    <int:service-activator ref="serviceC" method="doService" />
    </int:chain>

    <int:chain input-channel="channel-2">
    <int:service-activator ref="serviceD" method="doService" />
    <int:service-activator ref="serviceE" method="doService" />
    <int:service-activator ref="serviceF" method="doService" />
    </int:chain>

    <int:chain input-channel="channel-3">
    <int:service-activator ref="serviceA" method="doService" />
    <int:service-activator ref="serviceB" method="doService" />
    <int:service-activator ref="serviceC" method="doService" />
    <int:service-activator ref="serviceD" method="doService" />
    <int:service-activator ref="serviceE" method="doService" />
    <int:service-activator ref="serviceF" method="doService" />
    </int:chain>


    What I looking for is a simple solution that will enable me to do something like



    <int:chain input-channel="channel-3">
    <??? channel-1 />
    <??? channel-2 />
    </int:chain>


    Is there some simple way to do that?










    share|improve this question



























      3












      3








      3








      I wish to create a message chain out of existing channels, without specifically write all the elements again.



      Currently I have several long chains that overlaps one another with certain elements. Every time I add a new element, I have to add it in several chains. I wish to create a chain of channels, that can be called as a sequence.



      To simplify, my applicationContext at the moment has 3 channels. channel 1 and channel 2, and channel 3 that consist of the two:



      <int:chain input-channel="channel-1">
      <int:service-activator ref="serviceA" method="doService" />
      <int:service-activator ref="serviceB" method="doService" />
      <int:service-activator ref="serviceC" method="doService" />
      </int:chain>

      <int:chain input-channel="channel-2">
      <int:service-activator ref="serviceD" method="doService" />
      <int:service-activator ref="serviceE" method="doService" />
      <int:service-activator ref="serviceF" method="doService" />
      </int:chain>

      <int:chain input-channel="channel-3">
      <int:service-activator ref="serviceA" method="doService" />
      <int:service-activator ref="serviceB" method="doService" />
      <int:service-activator ref="serviceC" method="doService" />
      <int:service-activator ref="serviceD" method="doService" />
      <int:service-activator ref="serviceE" method="doService" />
      <int:service-activator ref="serviceF" method="doService" />
      </int:chain>


      What I looking for is a simple solution that will enable me to do something like



      <int:chain input-channel="channel-3">
      <??? channel-1 />
      <??? channel-2 />
      </int:chain>


      Is there some simple way to do that?










      share|improve this question
















      I wish to create a message chain out of existing channels, without specifically write all the elements again.



      Currently I have several long chains that overlaps one another with certain elements. Every time I add a new element, I have to add it in several chains. I wish to create a chain of channels, that can be called as a sequence.



      To simplify, my applicationContext at the moment has 3 channels. channel 1 and channel 2, and channel 3 that consist of the two:



      <int:chain input-channel="channel-1">
      <int:service-activator ref="serviceA" method="doService" />
      <int:service-activator ref="serviceB" method="doService" />
      <int:service-activator ref="serviceC" method="doService" />
      </int:chain>

      <int:chain input-channel="channel-2">
      <int:service-activator ref="serviceD" method="doService" />
      <int:service-activator ref="serviceE" method="doService" />
      <int:service-activator ref="serviceF" method="doService" />
      </int:chain>

      <int:chain input-channel="channel-3">
      <int:service-activator ref="serviceA" method="doService" />
      <int:service-activator ref="serviceB" method="doService" />
      <int:service-activator ref="serviceC" method="doService" />
      <int:service-activator ref="serviceD" method="doService" />
      <int:service-activator ref="serviceE" method="doService" />
      <int:service-activator ref="serviceF" method="doService" />
      </int:chain>


      What I looking for is a simple solution that will enable me to do something like



      <int:chain input-channel="channel-3">
      <??? channel-1 />
      <??? channel-2 />
      </int:chain>


      Is there some simple way to do that?







      java spring-integration






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 2 at 10:18









      Fábio Nascimento

      1,0051219




      1,0051219










      asked Jan 2 at 10:13









      StemplerStempler

      408




      408
























          1 Answer
          1






          active

          oldest

          votes


















          2














          I think you've miss-interpreted the concepts of chain and channel.




          1. The channel is at the core of pipes-and-filters as it is a pipe, so weather you use chain or not you still use channel. What chain allows you to do is to simplify the definition of the flow by letting you define a list of filter elements. Those elements are still connected with anonymous channels.


          2. The explicit channels (e.g., <int:channel...>) are there specifically to be referenced, allowing several flows to intwine with one another by sending and or receiving messages to/from such channels.



          So, hopefully you can see that creating chains from channels kind of goes against both pipes-and-filters architecture and the design of the framework which we tried to keep very consistent. In other words what I am reading from your post is that you have some flows that may be producers and/or consumers of other flows (wholly or partially) and if that's the case just use explicit channels.



          Here is the simplified version of your flow:



          <int:chain input-channel="channel-1" output-channel="channel-1out">
          <int:service-activator ref="serviceA" method="doService" />
          <int:service-activator ref="serviceB" method="doService" />
          <int:service-activator ref="serviceC" method="doService" />
          </int:chain>

          <int:chain input-channel="channel-2">
          <int:service-activator ref="serviceD" method="doService" />
          <int:service-activator ref="serviceE" method="doService" />
          <int:service-activator ref="serviceF" method="doService" />
          </int:chain>

          <int:bridge input-channel="channel-1out" output-channel="channel-2"





          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004472%2fcreate-new-message-chain-out-of-existing-channels%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            I think you've miss-interpreted the concepts of chain and channel.




            1. The channel is at the core of pipes-and-filters as it is a pipe, so weather you use chain or not you still use channel. What chain allows you to do is to simplify the definition of the flow by letting you define a list of filter elements. Those elements are still connected with anonymous channels.


            2. The explicit channels (e.g., <int:channel...>) are there specifically to be referenced, allowing several flows to intwine with one another by sending and or receiving messages to/from such channels.



            So, hopefully you can see that creating chains from channels kind of goes against both pipes-and-filters architecture and the design of the framework which we tried to keep very consistent. In other words what I am reading from your post is that you have some flows that may be producers and/or consumers of other flows (wholly or partially) and if that's the case just use explicit channels.



            Here is the simplified version of your flow:



            <int:chain input-channel="channel-1" output-channel="channel-1out">
            <int:service-activator ref="serviceA" method="doService" />
            <int:service-activator ref="serviceB" method="doService" />
            <int:service-activator ref="serviceC" method="doService" />
            </int:chain>

            <int:chain input-channel="channel-2">
            <int:service-activator ref="serviceD" method="doService" />
            <int:service-activator ref="serviceE" method="doService" />
            <int:service-activator ref="serviceF" method="doService" />
            </int:chain>

            <int:bridge input-channel="channel-1out" output-channel="channel-2"





            share|improve this answer






























              2














              I think you've miss-interpreted the concepts of chain and channel.




              1. The channel is at the core of pipes-and-filters as it is a pipe, so weather you use chain or not you still use channel. What chain allows you to do is to simplify the definition of the flow by letting you define a list of filter elements. Those elements are still connected with anonymous channels.


              2. The explicit channels (e.g., <int:channel...>) are there specifically to be referenced, allowing several flows to intwine with one another by sending and or receiving messages to/from such channels.



              So, hopefully you can see that creating chains from channels kind of goes against both pipes-and-filters architecture and the design of the framework which we tried to keep very consistent. In other words what I am reading from your post is that you have some flows that may be producers and/or consumers of other flows (wholly or partially) and if that's the case just use explicit channels.



              Here is the simplified version of your flow:



              <int:chain input-channel="channel-1" output-channel="channel-1out">
              <int:service-activator ref="serviceA" method="doService" />
              <int:service-activator ref="serviceB" method="doService" />
              <int:service-activator ref="serviceC" method="doService" />
              </int:chain>

              <int:chain input-channel="channel-2">
              <int:service-activator ref="serviceD" method="doService" />
              <int:service-activator ref="serviceE" method="doService" />
              <int:service-activator ref="serviceF" method="doService" />
              </int:chain>

              <int:bridge input-channel="channel-1out" output-channel="channel-2"





              share|improve this answer




























                2












                2








                2







                I think you've miss-interpreted the concepts of chain and channel.




                1. The channel is at the core of pipes-and-filters as it is a pipe, so weather you use chain or not you still use channel. What chain allows you to do is to simplify the definition of the flow by letting you define a list of filter elements. Those elements are still connected with anonymous channels.


                2. The explicit channels (e.g., <int:channel...>) are there specifically to be referenced, allowing several flows to intwine with one another by sending and or receiving messages to/from such channels.



                So, hopefully you can see that creating chains from channels kind of goes against both pipes-and-filters architecture and the design of the framework which we tried to keep very consistent. In other words what I am reading from your post is that you have some flows that may be producers and/or consumers of other flows (wholly or partially) and if that's the case just use explicit channels.



                Here is the simplified version of your flow:



                <int:chain input-channel="channel-1" output-channel="channel-1out">
                <int:service-activator ref="serviceA" method="doService" />
                <int:service-activator ref="serviceB" method="doService" />
                <int:service-activator ref="serviceC" method="doService" />
                </int:chain>

                <int:chain input-channel="channel-2">
                <int:service-activator ref="serviceD" method="doService" />
                <int:service-activator ref="serviceE" method="doService" />
                <int:service-activator ref="serviceF" method="doService" />
                </int:chain>

                <int:bridge input-channel="channel-1out" output-channel="channel-2"





                share|improve this answer















                I think you've miss-interpreted the concepts of chain and channel.




                1. The channel is at the core of pipes-and-filters as it is a pipe, so weather you use chain or not you still use channel. What chain allows you to do is to simplify the definition of the flow by letting you define a list of filter elements. Those elements are still connected with anonymous channels.


                2. The explicit channels (e.g., <int:channel...>) are there specifically to be referenced, allowing several flows to intwine with one another by sending and or receiving messages to/from such channels.



                So, hopefully you can see that creating chains from channels kind of goes against both pipes-and-filters architecture and the design of the framework which we tried to keep very consistent. In other words what I am reading from your post is that you have some flows that may be producers and/or consumers of other flows (wholly or partially) and if that's the case just use explicit channels.



                Here is the simplified version of your flow:



                <int:chain input-channel="channel-1" output-channel="channel-1out">
                <int:service-activator ref="serviceA" method="doService" />
                <int:service-activator ref="serviceB" method="doService" />
                <int:service-activator ref="serviceC" method="doService" />
                </int:chain>

                <int:chain input-channel="channel-2">
                <int:service-activator ref="serviceD" method="doService" />
                <int:service-activator ref="serviceE" method="doService" />
                <int:service-activator ref="serviceF" method="doService" />
                </int:chain>

                <int:bridge input-channel="channel-1out" output-channel="channel-2"






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 2 at 20:06

























                answered Jan 2 at 11:24









                Oleg ZhurakouskyOleg Zhurakousky

                1,88079




                1,88079
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004472%2fcreate-new-message-chain-out-of-existing-channels%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    'app-layout' is not a known element: how to share Component with different Modules

                    android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                    WPF add header to Image with URL pettitions [duplicate]