I have a route which polls a directory and sends the files to multiple locations.
I have set the configuration to delete on success and move to error on failure.
Question:
I was testing by denying write permissions to the file on the source folder which is being polled. The file transfer failed and the file was moved to the error folder and deleted from source folder.
If the file did not have write permissions and IO exception with permission denied was thrown, how was Camel File component able to move the file to the error folder?
And to clarify, we are doing a simple file transfer, and don't need to process the file.
You wrote you got an IOException in your test, so obviously Camel had not enough permissions to process the file.
Regarding read permissions should be enough to read the file: I suspect that this is not enough because of file locking or a similar thing. You could give it a try to set readLock=none. Perhaps this removes the need for write permissions.
For the successful handling of the error: As the link of #pvpkiran says, Camel does not need permission on the file to move it, but on the directory. The file itself is not changed.
Related
I currently have a directory (udir), which has only read and write permissions for all users. This directory contains two files (file1 & file2)
I initially though that only write access was needed (on the directory) for me to be able to delete/remove a file via (rm udir/file1) but the rm command would give me access denied. when i set the permissions to read, write, and execute, the rm command works.
Obviously the execute access is needed as well but why??
I thought the execute access on a directory was to be able to make it a working a directory and search its contents and access sub directories.
You actually need read, write and execute permissions on the directory, not on the file itself since the operation is done considering the permissions effects of directories.
A good documentation can be found on this link, which mentions the below in the section Special Considerations on Directories:
To delete a file requires both write (to modify the directory itself)
and execute (to stat() the file's inode) on a directory. Note a user
needs no permissions on a file nor be the file's owner to delete it!
I am mounting a folder as a virtual drive and i want to run a .exe file everytime user opens any file present in that folder. To be precise the folder would contain dummy files present on some other machine. By dummy files i mean the file would be listed but it would be a empty file. Whenever user opens a file i want the .exe program to download that file from another machine and display it to user.
That functionality (remote access on demand) can be implemented using reparse points and file system filters.
You could
use hooks to rewrite the jump address of OpenFile and in the
detour function check for the handle type, retrieve it's info by
using GetFileInformationByHandleEx, parse the data, download
what you need, open the downloaded file and then return
STATUS_SUCCESS or any appropriate error status in case one occurs.
Note
this is a bit more complicated as you also need a auto-inject
mechanism to inject function/library into each process according to
it's architecture.
this is not a safe procedure as most AV's will most likely consider your code malware.
I currently have a Mule application that listens for a file in an Input folder, and when detected, reads that file into a database and moves it to an Archive folder. I'd like to know if it's possible to move it to a temporary folder whilst it is being processed and then moved to Archive if read successfully, or to an Error folder if any issues are encountered. The ideal 'journey' of the file would be:
Input Folder
Temp Processing Folder
Archive Folder (success) OR Error Folder (issue found)
I'm currently only able to read the file from Input and move it to Archive using the moveToDirectory attribute in my endpoint. Any advice would be appreciated, thanks in advance.
Configure a the work directory on the connector.
From the documentation:
workDirectory The directory path where the file
should be moved to prior to processing. The work directory must reside
on the same file system as the read directory.
Mule flow must download big and huge XML files to process. When provider writes a file in input folder, in the same time File endpoint component can download incomplete file or provider cannot complete write process for some reasons. Does Mule API provide handling the situation?
Please advise.
The file connector doesn't download data, are you mixing up with the HTTP connector? Or do you mean the Mule file transport picks-up a file while it is still being copied by the file producer?
If the latter, the best option is to write to file into a temporary location then move it to the Mule pick-up folder because moving a file is an atomic operation.
Alternatively, you can use the fileAge attribute on the file connector to configure Mule to only pick-up files that are older than the specified age. This can work only if you have an idea of the maximum time it takes the file writer to write the file.
I am creating a simple file server in c in linux. My approach is that i am sending the name of the file from the client. The file server receives file name. And search for the file and opens it for reading. Read data from it, and send the data to client.
But the problem is that name for the file on the client side. I transfer that server. I have printed name there and it is recieved there(I mean server). But the server program does not open file with specified name. And gives me an error: no such files or directory exist.
One that i must add is that: i have created .txt file and entered in it number from 1 to 30
You should show some code, and perhaps some log output, too.
I would guess that the problem is that the server executable is running with the wrong current directory. Are you sending full path names, with directories that perhaps only exist on the client?
Try using a debugger like gdb for the server. As unwind told you here, you might not be in the directory you want.
You might also, for debugging purposes, print (to stderr, to some logging or debugging file, or thru syslog) the result of getcwd(3) (or perhaps ofget_current_dir_name) in your server before the open or fopen call.