Streaming objects from S3 Object using Spring Aws Integration





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







0















I am working on a usecase where I am supposed to poll S3 -> read the stream for the content -> do some processing and upload it to another bucket rather than writing the file in my server.



I know I can achieve it using S3StreamingMessageSource in Spring aws integration but the problem I am facing is that I do not know on how to process the message stream received by polling



public class S3PollerConfigurationUsingStreaming {
@Value("${amazonProperties.bucketName}")
private String bucketName;

@Value("${amazonProperties.newBucket}")
private String newBucket;

@Autowired
private AmazonClientService amazonClient;

@Bean
@InboundChannelAdapter(value = "s3Channel", poller = @Poller(fixedDelay = "100"))
public MessageSource<InputStream> s3InboundStreamingMessageSource() {
S3StreamingMessageSource messageSource = new S3StreamingMessageSource(template());
messageSource.setRemoteDirectory(bucketName);
messageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(),
"streaming"));
return messageSource;
}

@Bean
@Transformer(inputChannel = "s3Channel", outputChannel = "data")
public org.springframework.integration.transformer.Transformer transformer() {
return new StreamTransformer();
}

@Bean
public S3RemoteFileTemplate template() {
return new S3RemoteFileTemplate(new S3SessionFactory(amazonClient.getS3Client()));
}

@Bean
public PollableChannel s3Channel() {
return new QueueChannel();
}

@Bean
IntegrationFlow fileStreamingFlow() {
return IntegrationFlows
.from(s3InboundStreamingMessageSource(),
e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
.handle(streamFile())
.get();
}

}


Can someone please help me with the code to process the stream ?










share|improve this question





























    0















    I am working on a usecase where I am supposed to poll S3 -> read the stream for the content -> do some processing and upload it to another bucket rather than writing the file in my server.



    I know I can achieve it using S3StreamingMessageSource in Spring aws integration but the problem I am facing is that I do not know on how to process the message stream received by polling



    public class S3PollerConfigurationUsingStreaming {
    @Value("${amazonProperties.bucketName}")
    private String bucketName;

    @Value("${amazonProperties.newBucket}")
    private String newBucket;

    @Autowired
    private AmazonClientService amazonClient;

    @Bean
    @InboundChannelAdapter(value = "s3Channel", poller = @Poller(fixedDelay = "100"))
    public MessageSource<InputStream> s3InboundStreamingMessageSource() {
    S3StreamingMessageSource messageSource = new S3StreamingMessageSource(template());
    messageSource.setRemoteDirectory(bucketName);
    messageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(),
    "streaming"));
    return messageSource;
    }

    @Bean
    @Transformer(inputChannel = "s3Channel", outputChannel = "data")
    public org.springframework.integration.transformer.Transformer transformer() {
    return new StreamTransformer();
    }

    @Bean
    public S3RemoteFileTemplate template() {
    return new S3RemoteFileTemplate(new S3SessionFactory(amazonClient.getS3Client()));
    }

    @Bean
    public PollableChannel s3Channel() {
    return new QueueChannel();
    }

    @Bean
    IntegrationFlow fileStreamingFlow() {
    return IntegrationFlows
    .from(s3InboundStreamingMessageSource(),
    e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
    .handle(streamFile())
    .get();
    }

    }


    Can someone please help me with the code to process the stream ?










    share|improve this question

























      0












      0








      0








      I am working on a usecase where I am supposed to poll S3 -> read the stream for the content -> do some processing and upload it to another bucket rather than writing the file in my server.



      I know I can achieve it using S3StreamingMessageSource in Spring aws integration but the problem I am facing is that I do not know on how to process the message stream received by polling



      public class S3PollerConfigurationUsingStreaming {
      @Value("${amazonProperties.bucketName}")
      private String bucketName;

      @Value("${amazonProperties.newBucket}")
      private String newBucket;

      @Autowired
      private AmazonClientService amazonClient;

      @Bean
      @InboundChannelAdapter(value = "s3Channel", poller = @Poller(fixedDelay = "100"))
      public MessageSource<InputStream> s3InboundStreamingMessageSource() {
      S3StreamingMessageSource messageSource = new S3StreamingMessageSource(template());
      messageSource.setRemoteDirectory(bucketName);
      messageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(),
      "streaming"));
      return messageSource;
      }

      @Bean
      @Transformer(inputChannel = "s3Channel", outputChannel = "data")
      public org.springframework.integration.transformer.Transformer transformer() {
      return new StreamTransformer();
      }

      @Bean
      public S3RemoteFileTemplate template() {
      return new S3RemoteFileTemplate(new S3SessionFactory(amazonClient.getS3Client()));
      }

      @Bean
      public PollableChannel s3Channel() {
      return new QueueChannel();
      }

      @Bean
      IntegrationFlow fileStreamingFlow() {
      return IntegrationFlows
      .from(s3InboundStreamingMessageSource(),
      e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
      .handle(streamFile())
      .get();
      }

      }


      Can someone please help me with the code to process the stream ?










      share|improve this question














      I am working on a usecase where I am supposed to poll S3 -> read the stream for the content -> do some processing and upload it to another bucket rather than writing the file in my server.



      I know I can achieve it using S3StreamingMessageSource in Spring aws integration but the problem I am facing is that I do not know on how to process the message stream received by polling



      public class S3PollerConfigurationUsingStreaming {
      @Value("${amazonProperties.bucketName}")
      private String bucketName;

      @Value("${amazonProperties.newBucket}")
      private String newBucket;

      @Autowired
      private AmazonClientService amazonClient;

      @Bean
      @InboundChannelAdapter(value = "s3Channel", poller = @Poller(fixedDelay = "100"))
      public MessageSource<InputStream> s3InboundStreamingMessageSource() {
      S3StreamingMessageSource messageSource = new S3StreamingMessageSource(template());
      messageSource.setRemoteDirectory(bucketName);
      messageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(),
      "streaming"));
      return messageSource;
      }

      @Bean
      @Transformer(inputChannel = "s3Channel", outputChannel = "data")
      public org.springframework.integration.transformer.Transformer transformer() {
      return new StreamTransformer();
      }

      @Bean
      public S3RemoteFileTemplate template() {
      return new S3RemoteFileTemplate(new S3SessionFactory(amazonClient.getS3Client()));
      }

      @Bean
      public PollableChannel s3Channel() {
      return new QueueChannel();
      }

      @Bean
      IntegrationFlow fileStreamingFlow() {
      return IntegrationFlows
      .from(s3InboundStreamingMessageSource(),
      e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
      .handle(streamFile())
      .get();
      }

      }


      Can someone please help me with the code to process the stream ?







      amazon-s3 streaming spring-integration spring-integration-aws






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 18:34









      Aarish RameshAarish Ramesh

      2,34873475




      2,34873475
























          1 Answer
          1






          active

          oldest

          votes


















          2














          Not sure what is your problem, but I see that you have a mix of concerns. If you use messaging annotations (see @InboundChannelAdapter in your config), what is the point to use the same s3InboundStreamingMessageSource in the IntegrationFlow definition?



          Anyway it looks like you have already explored for yourself a StreamTransformer. This one has a charset property to convert your InputStreamfrom the remote S3 resource to the String. Otherwise it returns a byte. Everything else is up to you what and how to do with this converted content.



          Also I don't see reason to have an s3Channel as a QueueChannel, since the start of your flow is pollable anyway by the @InboundChannelAdapter.



          From big height I would say we have more questions to you, than vise versa...



          UPDATE



          Not clear what is your idea for InputStream processing, but that is really a fact that after S3StreamingMessageSource you are going to have exactly InputStream as a payload in the next handler.



          Also not sure what is your streamFile(), but it must really expect InputStream as an input from the payload of the request message.
          You also can use the mentioned StreamTransformer over there:



          @Bean
          IntegrationFlow fileStreamingFlow() {
          return IntegrationFlows
          .from(s3InboundStreamingMessageSource(),
          e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
          .transform(Transformers.fromStream("UTF-8"))
          .get();
          }


          And the next .handle() will be ready for String as a payload.






          share|improve this answer


























          • Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

            – Aarish Ramesh
            Jan 4 at 20:53













          • I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

            – Aarish Ramesh
            Jan 4 at 20:58








          • 1





            I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

            – Artem Bilan
            Jan 4 at 20:59













          • See an UPDATE in my answer.

            – Artem Bilan
            Jan 4 at 21:00






          • 1





            First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

            – Artem Bilan
            Jan 4 at 21:10












          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%2f54044335%2fstreaming-objects-from-s3-object-using-spring-aws-integration%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














          Not sure what is your problem, but I see that you have a mix of concerns. If you use messaging annotations (see @InboundChannelAdapter in your config), what is the point to use the same s3InboundStreamingMessageSource in the IntegrationFlow definition?



          Anyway it looks like you have already explored for yourself a StreamTransformer. This one has a charset property to convert your InputStreamfrom the remote S3 resource to the String. Otherwise it returns a byte. Everything else is up to you what and how to do with this converted content.



          Also I don't see reason to have an s3Channel as a QueueChannel, since the start of your flow is pollable anyway by the @InboundChannelAdapter.



          From big height I would say we have more questions to you, than vise versa...



          UPDATE



          Not clear what is your idea for InputStream processing, but that is really a fact that after S3StreamingMessageSource you are going to have exactly InputStream as a payload in the next handler.



          Also not sure what is your streamFile(), but it must really expect InputStream as an input from the payload of the request message.
          You also can use the mentioned StreamTransformer over there:



          @Bean
          IntegrationFlow fileStreamingFlow() {
          return IntegrationFlows
          .from(s3InboundStreamingMessageSource(),
          e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
          .transform(Transformers.fromStream("UTF-8"))
          .get();
          }


          And the next .handle() will be ready for String as a payload.






          share|improve this answer


























          • Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

            – Aarish Ramesh
            Jan 4 at 20:53













          • I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

            – Aarish Ramesh
            Jan 4 at 20:58








          • 1





            I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

            – Artem Bilan
            Jan 4 at 20:59













          • See an UPDATE in my answer.

            – Artem Bilan
            Jan 4 at 21:00






          • 1





            First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

            – Artem Bilan
            Jan 4 at 21:10
















          2














          Not sure what is your problem, but I see that you have a mix of concerns. If you use messaging annotations (see @InboundChannelAdapter in your config), what is the point to use the same s3InboundStreamingMessageSource in the IntegrationFlow definition?



          Anyway it looks like you have already explored for yourself a StreamTransformer. This one has a charset property to convert your InputStreamfrom the remote S3 resource to the String. Otherwise it returns a byte. Everything else is up to you what and how to do with this converted content.



          Also I don't see reason to have an s3Channel as a QueueChannel, since the start of your flow is pollable anyway by the @InboundChannelAdapter.



          From big height I would say we have more questions to you, than vise versa...



          UPDATE



          Not clear what is your idea for InputStream processing, but that is really a fact that after S3StreamingMessageSource you are going to have exactly InputStream as a payload in the next handler.



          Also not sure what is your streamFile(), but it must really expect InputStream as an input from the payload of the request message.
          You also can use the mentioned StreamTransformer over there:



          @Bean
          IntegrationFlow fileStreamingFlow() {
          return IntegrationFlows
          .from(s3InboundStreamingMessageSource(),
          e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
          .transform(Transformers.fromStream("UTF-8"))
          .get();
          }


          And the next .handle() will be ready for String as a payload.






          share|improve this answer


























          • Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

            – Aarish Ramesh
            Jan 4 at 20:53













          • I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

            – Aarish Ramesh
            Jan 4 at 20:58








          • 1





            I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

            – Artem Bilan
            Jan 4 at 20:59













          • See an UPDATE in my answer.

            – Artem Bilan
            Jan 4 at 21:00






          • 1





            First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

            – Artem Bilan
            Jan 4 at 21:10














          2












          2








          2







          Not sure what is your problem, but I see that you have a mix of concerns. If you use messaging annotations (see @InboundChannelAdapter in your config), what is the point to use the same s3InboundStreamingMessageSource in the IntegrationFlow definition?



          Anyway it looks like you have already explored for yourself a StreamTransformer. This one has a charset property to convert your InputStreamfrom the remote S3 resource to the String. Otherwise it returns a byte. Everything else is up to you what and how to do with this converted content.



          Also I don't see reason to have an s3Channel as a QueueChannel, since the start of your flow is pollable anyway by the @InboundChannelAdapter.



          From big height I would say we have more questions to you, than vise versa...



          UPDATE



          Not clear what is your idea for InputStream processing, but that is really a fact that after S3StreamingMessageSource you are going to have exactly InputStream as a payload in the next handler.



          Also not sure what is your streamFile(), but it must really expect InputStream as an input from the payload of the request message.
          You also can use the mentioned StreamTransformer over there:



          @Bean
          IntegrationFlow fileStreamingFlow() {
          return IntegrationFlows
          .from(s3InboundStreamingMessageSource(),
          e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
          .transform(Transformers.fromStream("UTF-8"))
          .get();
          }


          And the next .handle() will be ready for String as a payload.






          share|improve this answer















          Not sure what is your problem, but I see that you have a mix of concerns. If you use messaging annotations (see @InboundChannelAdapter in your config), what is the point to use the same s3InboundStreamingMessageSource in the IntegrationFlow definition?



          Anyway it looks like you have already explored for yourself a StreamTransformer. This one has a charset property to convert your InputStreamfrom the remote S3 resource to the String. Otherwise it returns a byte. Everything else is up to you what and how to do with this converted content.



          Also I don't see reason to have an s3Channel as a QueueChannel, since the start of your flow is pollable anyway by the @InboundChannelAdapter.



          From big height I would say we have more questions to you, than vise versa...



          UPDATE



          Not clear what is your idea for InputStream processing, but that is really a fact that after S3StreamingMessageSource you are going to have exactly InputStream as a payload in the next handler.



          Also not sure what is your streamFile(), but it must really expect InputStream as an input from the payload of the request message.
          You also can use the mentioned StreamTransformer over there:



          @Bean
          IntegrationFlow fileStreamingFlow() {
          return IntegrationFlows
          .from(s3InboundStreamingMessageSource(),
          e -> e.poller(p -> p.fixedDelay(30, TimeUnit.SECONDS)))
          .transform(Transformers.fromStream("UTF-8"))
          .get();
          }


          And the next .handle() will be ready for String as a payload.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 4 at 20:58

























          answered Jan 4 at 19:44









          Artem BilanArtem Bilan

          68.5k84973




          68.5k84973













          • Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

            – Aarish Ramesh
            Jan 4 at 20:53













          • I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

            – Aarish Ramesh
            Jan 4 at 20:58








          • 1





            I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

            – Artem Bilan
            Jan 4 at 20:59













          • See an UPDATE in my answer.

            – Artem Bilan
            Jan 4 at 21:00






          • 1





            First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

            – Artem Bilan
            Jan 4 at 21:10



















          • Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

            – Aarish Ramesh
            Jan 4 at 20:53













          • I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

            – Aarish Ramesh
            Jan 4 at 20:58








          • 1





            I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

            – Artem Bilan
            Jan 4 at 20:59













          • See an UPDATE in my answer.

            – Artem Bilan
            Jan 4 at 21:00






          • 1





            First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

            – Artem Bilan
            Jan 4 at 21:10

















          Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

          – Aarish Ramesh
          Jan 4 at 20:53







          Thanks a lot for pointing out the concerns with the code. My exact question is how do i get the input stream from remote S3 resource in the streamFile() method so that I can process it ? I am new to spring-integration that's why I am not getting the hang of it

          – Aarish Ramesh
          Jan 4 at 20:53















          I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

          – Aarish Ramesh
          Jan 4 at 20:58







          I know I will have to get the file from payload like below MessageSource<InputStream> msgSource; msgSource.receive().getPayload() . My doubt is from where do I get the msgSource ? I know it might sound naive but I very new to spring-integration

          – Aarish Ramesh
          Jan 4 at 20:58






          1




          1





          I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

          – Artem Bilan
          Jan 4 at 20:59







          I don't know how to explain your simple way, but you don't call msgSource.receive() yourself. The @InboundChannelAdapter or ntegrationFlows.from() with the poller does the trick to poll that MessageSource and produce messages for the configured channel with the InputStream as a payload for each remote file.

          – Artem Bilan
          Jan 4 at 20:59















          See an UPDATE in my answer.

          – Artem Bilan
          Jan 4 at 21:00





          See an UPDATE in my answer.

          – Artem Bilan
          Jan 4 at 21:00




          1




          1





          First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

          – Artem Bilan
          Jan 4 at 21:10





          First of all the code is not readable in the comment. Second, if you need exactly InputStream, you don't need that transformer at all, but just expect InputStream in the arguments of your processFile(). There is just no File in case of s3InboundStreamingMessageSource. Please, read more in the reference manual: docs.spring.io/spring-integration/reference/html/…. You need to understand that s3InboundStreamingMessageSource produces messages exactly with the InputStream payloads and that is what you need exact in your POJO method for the handle()

          – Artem Bilan
          Jan 4 at 21:10




















          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%2f54044335%2fstreaming-objects-from-s3-object-using-spring-aws-integration%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

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas