inbound sftp channel adapter file locking issue - spring-integration

I am using sftp inbound channel adapter with custom remote filter. If filter accept that file then it is processed later and deleted fine as i set property "true" for remote delete.
Now when my file is not processed successfully and throws exception then i catch that exception and want to move locally download file to someother place but when i do that using FileUtils.forceDelete then it is throwing exception
java.io.IOException: Unable to delete file:
Looks like some other thread has lock on this file. Is there any way we can find out who owns the lock and how to release it so that my listener can move it to diff location.

not processed successfully and throws exception
Be sure to close the file in a finally block so your processing logic will always close the file.

Related

Add-PnPApp : The request message was already sent. Cannot send the same request message multiple times

I'm new to using Azure DevOps. I continue to receive this error "Add-PnPApp : The request message was already sent. Cannot send the same request message multiple times."
Azure DevOps Release fails because of AddPnP error with "...same request".
Build shows version that changes my version (old) to a new version(gulp's version?).
Image of build
I'm told that it could be the version that starts with zero because SharePoint doesn't like it. I can't seem to change the new version to 1.0.0.1 because it seems like it's being changed in the gulp-file.js. Is there something else that I am missing?
image of release
Is it possible that you need the overwrite parameter in the AddPnP command? Or is it possible you would need to iterate the version between each release?
https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpapp?view=sharepoint-ps
In my case the same message
The request message was already sent. Cannot send the same request message multiple times
was misleading. I tried to update dynamically an .sppkg package (which is in fact a ZIP file) during an automated deployment, but the file _rels/.rels was getting lost in the process (because of the bug Unable to compress hidden files with Compress-Archive) and the resulting package was corrupted.
Once I fixed the package by making sure the file _rels/.rels was kept, the deployment would succeed.

How to create custom scheduler in sugarcrm?

I am trying to create custom scheduler in sugarcrm using its documentation in
http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Architecture/Job_Queue/Schedulers/Creating_Custom_Schedulers/.
I have created job label in path ./custom/Extension/modules/Schedulers/Ext/Language/en_us.final_test.php
with code
$mod_strings['LBL_FINAL_TEST'] = 'Final Test Of Scheduler';
and created job function in path
./custom/Extension/modules/Schedulers/Ext/ScheduledTasks/final_test.php
with code
<?php
array_push($job_strings, 'final_test');
$GLOBALS['log']->fatal('my fatal message inside function');//this works
function final_test(){
$GLOBALS['log']->fatal('my fatal message inside function');//this don't
return true;
}
?>
Here if i put
$GLOBALS['log']->fatal('my fatal message outside function');
outside the function then it runs I get message in log file. But
when i put
$GLOBALS['log']->fatal('my fatal message inside function');
inside the function then this doesn't work and i don't get any log.
Which part am I doing wrong? where can I get proper tutorial to develop custom scheduler for sugarcrm?
NOTE: I have set the scheduler to run at every minute
I'd guess that your Schedulers are not running at all.
(Your "outside" message probably only makes it into the log whenever the file is loaded in general)
Make sure your cron jobs are configured correctly, as they are required to call Sugar's Scheduler Engine every minute: https://support.sugarcrm.com/Knowledge_Base/Schedulers/Introduction_to_Cron_Jobs/
If you don't feel like setting them up, you could also manually trigger Schedulers with php -f cron.php (on web service account e.g. sudo -u www-data php -f cron.php if on Debian linux) in your Sugar directory.
If your function's output still doesn't appear in the logs:
Check if your current function is in custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php. If not, run a Quick Repair & Rebuild.
Check file permissions on the log file
Check your PHP log/output for errors. E.g. in case you defined a function called "final_test" somewhere else already, PHP would terminate with a fatal error due to a function name collision.

Build Error: while running worker Role in local system

I am new to Azure Worker Role ,I have created a new Azure Cloud Service project and added a worker role.In which I have a thread that makes function call to sampledll where I am creating EventHub listener.
I found error like below.
Severity Code Description Project File Line Suppression State
Error The process cannot access the file 'D:\Azure\roles\simpleWorkerRole\approot\sampledll.dll' because it is being used by another process. simpleWorkerRole.WorkerRole C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.9\Microsoft.WindowsAzure.targets 1057
The process cannot access the file 'D:\Azure\roles\simpleWorkerRole\approot\sampledll.dll' because it is being used by another process.
The error message indicates the sampledll.dll is being used by another process, you could try to use Process Monitor tool to find which process is using (or locking) sampledll.dll and then you could manually end the process and rebuild the solution.

How to pass message headers through pseudo transaction manager?

I am polling for files for a service-activator, using a PseudoTransactionManager to move them into processed/failed directories.
If/when the move fails, I would like to log this, including the file name.
As the information being passed around the flows is the Message object, I tried enriching the file name onto its header, but as we make copies of it for each step, this won't work unless I can move the header-enricher between the inbound channel adapter and transaction manager.
In simplified form the main flow I now have is this:
inbound-channel-adapter -> a) header-enricher -> service-activator
Because I want the files moved to a processed or failed directory, there is a second flow:
inbound-channel-adapter -> b) pseudo transaction-manager -> logging-channel-adapter (in case of problems moving the processed file).
I think this follows because the transaction manager definition is nested within the channel adapter definition in the xml.
How can I pass this information through the example setup here to a logging channel adapter?
The transaction stuff only has access to the original message. You can add an error-channel to the poller; the default error channel (errorChannel) is a pub/sub channel and has a logging channel adapter subscribed to it.
When an exception occurs, an ErrorMessage is sent to the error channel (if configured); the payload is a MessagingException with cause and failedMessage properties. The failedMessage is the message at the point the failure occurred.
The default error flow will simply log the message so your "transaction" will "commit".
Instead, you need a custom error flow; log what you want and then re-throw the cause and your "transaction" will "rollback".

int-ftp:outbound-gateway - handling exceptions (file already exists on GET)

I am using int-ftp:outbound-gateway sample given in GITHUB.
Its working for me. The problem I am facing is : If the file already exists in my local its not overwriting with the file from FTP. Its throwing the following error and the execution stops :
I want to overwrite the local copy... Any idea on how to handle this scenario ?
WARNING: failure occurred in gateway sendAndReceive
Throwable occurred: org.springframework.integration.MessagingException: Local file \TOPROCESS\UserLastLoginData2015-10-08.csv already exists
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.get(AbstractRemoteFileOutboundGateway.java:677)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway$2.doInSession(AbstractRemoteFileOutboundGateway.java:423)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway$2.doInSession(AbstractRemoteFileOutboundGateway.java:419)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:295)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doGet(AbstractRemoteFileOutboundGateway.java:419)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:381)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:142)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
Starting with Spring Integration version 4.1.4, you can set mode="REPLACE" on the outbound gateway.

Resources