I want to upload three json file from my local directory to a remote SFTP location in one shot. I cannot afford to upload them one by one. What inbound adaptor, channel and sftpoutbound gateway configuration should I use ? I know there is something call mput in outbound gateway. But I have never used the mput code wise.
See docs for MPUT command: https://docs.spring.io/spring-integration/docs/current/reference/html/sftp.html#using-the-mput-command
The message payload must be a java.io.File (or String) that represents a local directory.
So, a request message for MPUT command must have a payload as a local dir with files you'd like to transfer. Therefore it might not be ideal for you to deal with a file inbound channel adapter.
You can aggregate polled files into a single directory before sending a message with it into that SFTP outbound gateway.
Related
I want to send a request to a server to download a file. However, when the file is sent by the server, I don't want to actually receive the file. I'm trying to see if it's possible for me to overload a server's bandwidth without having to actually download files.
I'm guessing this should be possible using some sort of a UDP protocol where no acknowledgements are required.
If the download is available via HTTP GET, you can try sending an HTTP HEAD request with the same headers to try to receive a response without the server actually sending the file.
I have a client trying to upload multiple files to FTP server in passive mode.
The client sends PASV command and the server responds with the relevant ip and port.
Is it possible to send multiple files on this one data connection? or the client need to send the PASV command and get a new port for each file?
Since the only indicator of the end of file is the close of the connection and because you cannot transfer any more data after the connection has closed, you will not be able to transfer more than one file using the same data connection.
But, maybe you tried to ask a different question, that is if is possible to have multiple data transfers (and thus multiple data connections) after a single PASV command? I can see nothing in RFC959 which directly would prevent this and reusing the same target port on the server. And because access would be done from different source ports on the client this should also not give problems with TCP connection states. But, in practice you will probably see problems because if you try to use this from the client side, because lots of servers create the listener only for a single data connection. So you better precede each data transfer with a new PASV command, like existing clients do.
I have a FTP send port on which I want a successful delivery notification on successful upload of the file. The FTP send port is directly bound to a direct send port in the orchestration, using a filter expression, as I have multiple send ports for that direct send port based on the content of the message.
Is there a way I can achieve a successful delivery notification when the files are successfully uploaded to the FTP location.
You can use Delivery Notifications on the Send Ports. Here's a good blog on the topic: http://kentweare.blogspot.com/2007/11/biztalk-delivery-notification.html
Just keep in mind that this is not Guaranteed Delivery, especially with a protocol like FTP. Basically, you will get the successful ACK if the Adapter sent the message without error. This is not a problem with BizTalk, rather FTP is in no way transactional and anything that goes wrong on the server is out reach of your app.
I have a requirement to develop an SFTP adapter which will download files from a remote location. This process will be scheduled using a quartz scheduler and the schedule time will be set from a gui. I was initially using spring SFTP inbound adapter but I realized that it is a poller consumer. However I want it to be invoked by my quartz scheduler instead of the poller. Could it be done? Can I make my SFTP inbound adapter event driven instead of poller driven?
No, but you have a few options...
Use outbound-gateway(s) instead; you can use one gateway to list (ls) the remote directory, followed by a <splitter/> and another outbound gateway to get the files; a third gateway can then rm the remote file(s). There's an example of that in the SFTP Sample App Or, you can use a single <outbound-gateway/> to mget all the files matching a pattern (e.g. /foo/*.txt).
Use the technique I described in this answer.
I want to implement a Client-Server program in which the client has to send a file to the server. In this case, what is the efficient way to send the file to server?
I am thinking in the following method,
After the connection establishment, First, I have to send the file name (which i want to upload) to server from client. Then I have to send the file content to server. The server will wait for the file content after received the file name from client.
So, for uploading a file, I need 2 write method in client & 2 read method in server.
Is this ok? Is there any other efficient way for doing this?
I think that your idea is correct. Maybe you should consider not to send files name (only the extension line .jpg) and let server generate one. This will prevent overwriting some already existing files.