Generate Spring-integration daily statistics report





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Have a spring integration application where files are routed from a folder to S3 buckets using s3-outbound-channel-adapter. If the file processed successfully, then file will be moved to corresponding target-bucket. if any error , file move to error bucket via error channel.



Have to generate a daily statistics report in a text file containing below details.



Total no of files processed:
Total success :
Total Error:



Would like to know how to get no of files processed successfully/error. Is there any way to achieve this requirement.



Any suggestion or example would be helpful.



Gone through the DefaultMessageChannelMetrics and Micrometer Integration in documentation. Not sure it will help my requirement.



Have separate gateway and adapter to process success and error files.



Success :



<int-aws:s3-outbound-gateway id="s3FileMover"
request-channel="filesOutS3GateWay"
reply-channel="filesOutS3ChainChannel"
transfer-manager="transferManager"
bucket-expression = "headers.TARGET_PATH"
key-expression="headers.file_name"
command="UPLOAD">
<int-aws:request-handler-advice-chain>
<ref bean="retryAdvice" />
</int-aws:request-handler-advice-chain>
</int-aws:s3-outbound-gateway>


Error :



<int-aws:s3-outbound-channel-adapter id="filesErrorS3Mover"
channel="filesErrorS3MoverChannel"
transfer-manager="transferManager"
bucket="${aws.s3.error.bucket}"
key-expression="headers.TARGET + '/' + headers.file_name"
upload-metadata-provider = "fileMetaDataProvider"
command="UPLOAD">
<int-aws:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="onSuccessExpressionString" value="payload.delete()"/>
</bean>
</int-aws:request-handler-advice-chain>









share|improve this question





























    1















    Have a spring integration application where files are routed from a folder to S3 buckets using s3-outbound-channel-adapter. If the file processed successfully, then file will be moved to corresponding target-bucket. if any error , file move to error bucket via error channel.



    Have to generate a daily statistics report in a text file containing below details.



    Total no of files processed:
    Total success :
    Total Error:



    Would like to know how to get no of files processed successfully/error. Is there any way to achieve this requirement.



    Any suggestion or example would be helpful.



    Gone through the DefaultMessageChannelMetrics and Micrometer Integration in documentation. Not sure it will help my requirement.



    Have separate gateway and adapter to process success and error files.



    Success :



    <int-aws:s3-outbound-gateway id="s3FileMover"
    request-channel="filesOutS3GateWay"
    reply-channel="filesOutS3ChainChannel"
    transfer-manager="transferManager"
    bucket-expression = "headers.TARGET_PATH"
    key-expression="headers.file_name"
    command="UPLOAD">
    <int-aws:request-handler-advice-chain>
    <ref bean="retryAdvice" />
    </int-aws:request-handler-advice-chain>
    </int-aws:s3-outbound-gateway>


    Error :



    <int-aws:s3-outbound-channel-adapter id="filesErrorS3Mover"
    channel="filesErrorS3MoverChannel"
    transfer-manager="transferManager"
    bucket="${aws.s3.error.bucket}"
    key-expression="headers.TARGET + '/' + headers.file_name"
    upload-metadata-provider = "fileMetaDataProvider"
    command="UPLOAD">
    <int-aws:request-handler-advice-chain>
    <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
    <property name="onSuccessExpressionString" value="payload.delete()"/>
    </bean>
    </int-aws:request-handler-advice-chain>









    share|improve this question

























      1












      1








      1








      Have a spring integration application where files are routed from a folder to S3 buckets using s3-outbound-channel-adapter. If the file processed successfully, then file will be moved to corresponding target-bucket. if any error , file move to error bucket via error channel.



      Have to generate a daily statistics report in a text file containing below details.



      Total no of files processed:
      Total success :
      Total Error:



      Would like to know how to get no of files processed successfully/error. Is there any way to achieve this requirement.



      Any suggestion or example would be helpful.



      Gone through the DefaultMessageChannelMetrics and Micrometer Integration in documentation. Not sure it will help my requirement.



      Have separate gateway and adapter to process success and error files.



      Success :



      <int-aws:s3-outbound-gateway id="s3FileMover"
      request-channel="filesOutS3GateWay"
      reply-channel="filesOutS3ChainChannel"
      transfer-manager="transferManager"
      bucket-expression = "headers.TARGET_PATH"
      key-expression="headers.file_name"
      command="UPLOAD">
      <int-aws:request-handler-advice-chain>
      <ref bean="retryAdvice" />
      </int-aws:request-handler-advice-chain>
      </int-aws:s3-outbound-gateway>


      Error :



      <int-aws:s3-outbound-channel-adapter id="filesErrorS3Mover"
      channel="filesErrorS3MoverChannel"
      transfer-manager="transferManager"
      bucket="${aws.s3.error.bucket}"
      key-expression="headers.TARGET + '/' + headers.file_name"
      upload-metadata-provider = "fileMetaDataProvider"
      command="UPLOAD">
      <int-aws:request-handler-advice-chain>
      <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
      <property name="onSuccessExpressionString" value="payload.delete()"/>
      </bean>
      </int-aws:request-handler-advice-chain>









      share|improve this question














      Have a spring integration application where files are routed from a folder to S3 buckets using s3-outbound-channel-adapter. If the file processed successfully, then file will be moved to corresponding target-bucket. if any error , file move to error bucket via error channel.



      Have to generate a daily statistics report in a text file containing below details.



      Total no of files processed:
      Total success :
      Total Error:



      Would like to know how to get no of files processed successfully/error. Is there any way to achieve this requirement.



      Any suggestion or example would be helpful.



      Gone through the DefaultMessageChannelMetrics and Micrometer Integration in documentation. Not sure it will help my requirement.



      Have separate gateway and adapter to process success and error files.



      Success :



      <int-aws:s3-outbound-gateway id="s3FileMover"
      request-channel="filesOutS3GateWay"
      reply-channel="filesOutS3ChainChannel"
      transfer-manager="transferManager"
      bucket-expression = "headers.TARGET_PATH"
      key-expression="headers.file_name"
      command="UPLOAD">
      <int-aws:request-handler-advice-chain>
      <ref bean="retryAdvice" />
      </int-aws:request-handler-advice-chain>
      </int-aws:s3-outbound-gateway>


      Error :



      <int-aws:s3-outbound-channel-adapter id="filesErrorS3Mover"
      channel="filesErrorS3MoverChannel"
      transfer-manager="transferManager"
      bucket="${aws.s3.error.bucket}"
      key-expression="headers.TARGET + '/' + headers.file_name"
      upload-metadata-provider = "fileMetaDataProvider"
      command="UPLOAD">
      <int-aws:request-handler-advice-chain>
      <bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
      <property name="onSuccessExpressionString" value="payload.delete()"/>
      </bean>
      </int-aws:request-handler-advice-chain>






      spring spring-boot spring-integration spring-integration-sftp spring-integration-aws






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 '18 at 12:49









      JessieJessie

      45341021




      45341021
























          1 Answer
          1






          active

          oldest

          votes


















          1














          You can query and reset the MessageChannelMetrics directly on the message channels directly.



          getSendCount();
          reset();


          All standard message channels implement that interface so just inject the channel as that...



          @Autowired
          private MessageChannelMetrics filesOutS3GateWay;

          private int getCount() {
          return this.filesOutS3GateWay.getSendCount();
          }





          share|improve this answer


























          • Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

            – Jessie
            Nov 19 '18 at 16:15











          • All standard channels implement it; I edited the answer.

            – Gary Russell
            Nov 19 '18 at 18:09












          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%2f53338279%2fgenerate-spring-integration-daily-statistics-report%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









          1














          You can query and reset the MessageChannelMetrics directly on the message channels directly.



          getSendCount();
          reset();


          All standard message channels implement that interface so just inject the channel as that...



          @Autowired
          private MessageChannelMetrics filesOutS3GateWay;

          private int getCount() {
          return this.filesOutS3GateWay.getSendCount();
          }





          share|improve this answer


























          • Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

            – Jessie
            Nov 19 '18 at 16:15











          • All standard channels implement it; I edited the answer.

            – Gary Russell
            Nov 19 '18 at 18:09
















          1














          You can query and reset the MessageChannelMetrics directly on the message channels directly.



          getSendCount();
          reset();


          All standard message channels implement that interface so just inject the channel as that...



          @Autowired
          private MessageChannelMetrics filesOutS3GateWay;

          private int getCount() {
          return this.filesOutS3GateWay.getSendCount();
          }





          share|improve this answer


























          • Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

            – Jessie
            Nov 19 '18 at 16:15











          • All standard channels implement it; I edited the answer.

            – Gary Russell
            Nov 19 '18 at 18:09














          1












          1








          1







          You can query and reset the MessageChannelMetrics directly on the message channels directly.



          getSendCount();
          reset();


          All standard message channels implement that interface so just inject the channel as that...



          @Autowired
          private MessageChannelMetrics filesOutS3GateWay;

          private int getCount() {
          return this.filesOutS3GateWay.getSendCount();
          }





          share|improve this answer















          You can query and reset the MessageChannelMetrics directly on the message channels directly.



          getSendCount();
          reset();


          All standard message channels implement that interface so just inject the channel as that...



          @Autowired
          private MessageChannelMetrics filesOutS3GateWay;

          private int getCount() {
          return this.filesOutS3GateWay.getSendCount();
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 '18 at 18:09

























          answered Nov 16 '18 at 15:22









          Gary RussellGary Russell

          85.2k85178




          85.2k85178













          • Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

            – Jessie
            Nov 19 '18 at 16:15











          • All standard channels implement it; I edited the answer.

            – Gary Russell
            Nov 19 '18 at 18:09



















          • Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

            – Jessie
            Nov 19 '18 at 16:15











          • All standard channels implement it; I edited the answer.

            – Gary Russell
            Nov 19 '18 at 18:09

















          Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

          – Jessie
          Nov 19 '18 at 16:15





          Thank you. Can you share some examples link how to achieve it.. observed that MessageChannelMetrics is an interface. Would like to know how to implement the getSendCount methods... Not sure if I got your point correctly.

          – Jessie
          Nov 19 '18 at 16:15













          All standard channels implement it; I edited the answer.

          – Gary Russell
          Nov 19 '18 at 18:09





          All standard channels implement it; I edited the answer.

          – Gary Russell
          Nov 19 '18 at 18:09




















          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%2f53338279%2fgenerate-spring-integration-daily-statistics-report%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

          Bressuire

          Vorschmack

          Quarantine