Spring Integration listen for files via SftpInboundFileSynchronizer and @InboundChannelAdapter

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ • 47

  • @dvdvasconcelos
    @dvdvasconcelos 2 роки тому +1

    Thank you my friend, i wish you the best of this life!

  • @Korekt01
    @Korekt01 5 років тому +1

    Looks so simple and easy. Gotta love Spring. :)

    • @MikesTechCorner
      @MikesTechCorner  5 років тому +1

      SZ try to watch the K6 demo and let me know what you think. Its pretty good for perf. testing.

    • @Korekt01
      @Korekt01 5 років тому +1

      @@MikesTechCorner After watching the video I can say that I really like K6. :) Simple to use and powerful.

  • @zavzen4963
    @zavzen4963 4 роки тому +1

    Ty a lot bro. Very nice explanation. also subbed.

  • @ShubhamSingh-uv6is
    @ShubhamSingh-uv6is Рік тому +1

    In my case I want to connect to sftp servers dynamically as I can have multiple sftp servers, so I can’t create a bean with default session factory as it will be singleton right?
    can you suggest some solution?

    • @MikesTechCorner
      @MikesTechCorner  Рік тому

      Look at cloud buckets instead. Then you don't have to maintain it. Software as a service rocks. :)

  • @HemalathaS-HemS
    @HemalathaS-HemS 5 місяців тому +1

    How can I connect to 0.0.0.0 ?

    • @MikesTechCorner
      @MikesTechCorner  5 місяців тому

      0.0.0.0 or 127.0.0.1 are just local addresses to your network interface. If you use docker expose the port before connecting

  • @denisr.8248
    @denisr.8248 2 роки тому +1

    nice video i want to see part 2 where you create database with this files information later :)

  • @harishdeore453
    @harishdeore453 3 роки тому +1

    Thanks for this example. I have a query that how can we read & process multiple files from SFTP directory using Spring Integration using Spring Boot ?

    • @MikesTechCorner
      @MikesTechCorner  3 роки тому +1

      Try to watch the other sftp and Spring videos that I have made.

  • @sharathpoojary2535
    @sharathpoojary2535 Рік тому +1

    Great video..Thank u so much..
    I have some doubt on this.
    Instead of auto start, I wanted to start it and once downloaded want to stop it.
    How this can be done? Could you please help me on this?
    I have tried the autoStart flag, but it just doesn't start. Could not figure out how do I start

    • @MikesTechCorner
      @MikesTechCorner  Рік тому

      I don't know. Why do you want to stop listenening for files? Just ignore extra files.

  • @DaBomb225
    @DaBomb225 3 роки тому +1

    Great video! I have a question about how to delete the local version of the file once you are done processing. I've tried doing file.delete() at the end of handleIncomingMessage method, but the file does not get deleted. Is there a special way to delete local files with Spring Integration? Thanks for the help!

    • @MikesTechCorner
      @MikesTechCorner  3 роки тому

      Hmmm try to create a new file object with same path and delete that?

  • @selmathmundappilly6437
    @selmathmundappilly6437 4 роки тому +1

    Hi friend,
    how can I download file on event-based (on demand) using Spring SFTP integration - InboundChannelAdapter, instead of listening to the SFTP server

    • @MikesTechCorner
      @MikesTechCorner  4 роки тому

      Interesting topic. What kind of event? But yes you have to implement the custom code then

  • @ikshitbohray1216
    @ikshitbohray1216 2 роки тому +1

    Is there way to delete files from the remote server based on a filter using spring integration?

  • @chandanbharadwaj7480
    @chandanbharadwaj7480 4 роки тому +1

    Thank You for this video !!
    It is working only on start up, after that it is getting disconnected from sftp server , after printing below message in logs.
    RSA key fingerprint is *******************
    Are you sure you want to continue connecting?
    can you please help me

    • @MikesTechCorner
      @MikesTechCorner  4 роки тому

      You need add accept unknown keys or add the keys manually:
      public DefaultSftpSessionFactory gimmeFactory(){
      DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory();
      factory.setHost("0.0.0.0");
      factory.setPort(22);
      factory.setAllowUnknownKeys(true);
      factory.setUser("mike");
      factory.setPassword("password123");
      return factory;
      }
      Here is the code:
      github.com/ekim197711/springintegration-sftpmessagehandler/blob/master/src/main/java/com/codeinvestigator/springbootsftpmessagehandler/download/SftpSynchConfiguration.java

  • @angnguyen-vn2on
    @angnguyen-vn2on Рік тому

    how can I download 1 file with 1 path as a Resource. I don't want to save the file to the local machine.
    for example, I call API with the parameter path file. my service calls to sftp server and gets the file as a Resource.

    • @MikesTechCorner
      @MikesTechCorner  Рік тому

      You can open an output stream and then load the file as an input stream.

  • @Feiret
    @Feiret 4 роки тому +1

    hi friend! i have a trouble, my handleIncomingFile method didn`t call. can you help what`s wrong?

    • @MikesTechCorner
      @MikesTechCorner  4 роки тому

      Clone my repo and check file by file and check whats missing. Check the log for errors. Ok?

  • @superman-yb3gi
    @superman-yb3gi Рік тому +1

    Hi what about the session closure...where we need to close

    • @MikesTechCorner
      @MikesTechCorner  Рік тому

      Yes it is. If you want to control it your self then use Apache Common FTPClient commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html

    • @superman-yb3gi
      @superman-yb3gi Рік тому

      Hi,
      I can see the same code in an application but it cause connection leak issue in sftp server how can I close that... I think it not closing the session and use the connection continuously.... FYI POLLER every 2sec

  • @navd1488
    @navd1488 3 роки тому +1

    Thanks for the wonderful presentation. A couple of questions :
    1) how would this work in a clustered environment, where this is deployed into many nodes. Will multiple nodes download the same file?
    2) If after downloading the file is not deleted, will the file still show up in the a subsequent poll? Is there is a way to mark the file as read other than to physically delete it from the stpfolder?

    • @MikesTechCorner
      @MikesTechCorner  3 роки тому

      No delete the file or move to a folder named "done" or something. Regard cluster setup then the sftp instances would share same volumes

    • @navd1488
      @navd1488 3 роки тому

      @@MikesTechCorner Thanks for the quick reply. Just for some clarification on the cluster side of things, if one nodes starts to download a file, no other node would pick it up? this is not about sftp being deployed into many nodes. This is about the poller being deployed into many nodes

    • @MikesTechCorner
      @MikesTechCorner  3 роки тому

      @@navd1488 no the file is not locked. Move it to a "inprog" folder or place a metainfo file next to it

    • @navd1488
      @navd1488 3 роки тому +1

      @@MikesTechCorner thank you very much :)

  • @laksomphear9692
    @laksomphear9692 2 роки тому +1

    Hello sir, How to disconnect and connect session in ftp?

  • @artificialunintelligencee
    @artificialunintelligencee 4 роки тому +1

    Hi, how can we download all the files from the remote directory during one poll? Loved your teaching bdw...

    • @MikesTechCorner
      @MikesTechCorner  4 роки тому

      List the files and dl one by one

    • @artificialunintelligencee
      @artificialunintelligencee 4 роки тому

      @@MikesTechCorner the session.list() to be done in ServiceActivator level or InboundChannelAdapter level???

  • @Higurashi86
    @Higurashi86 2 роки тому +1

    is there a way for it to download files in subfolers as well?

    • @MikesTechCorner
      @MikesTechCorner  2 роки тому

      Yes you have to list all folders and download the files 1 by 1. It's just a couple of loops / methods.

  • @wasuvansundararajan6339
    @wasuvansundararajan6339 2 роки тому

    How to get notifications after deleted..? Please suggest some advice

    • @wasuvansundararajan6339
      @wasuvansundararajan6339 2 роки тому

      Please suggest can I listen the delete event after file got deleted..? Any filter implementation..?