cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Hook point in the Custom handler to find successful upload of file from Agent

lakshperi
1-Newbie

Hook point in the Custom handler to find successful upload of file from Agent

Hi,

 

We have a use-case in which the Custom handler/agent needs to delete a set of file used for Inter process communication after a successful upload of a logfile.

We have a hook point interface in Custom Handler for start of file upload(AX_OnFileUpload). Is there a hook point available to find if a file is successfully uploaded to the enterprise server?

 

Regards, Lakshman

1 ACCEPTED SOLUTION

Accepted Solutions

The Custom Handler API lacks support for notification on upload completion. For your use case, consider creating a Custom Component instead of Custom Handler. For an example of a custom component that carries out file upload, see CustomComponent/SampleComponents/SMExample in the Agent SDK directory. In that example, the ESMCustomMgr::FileUploadExample() method demonstrates how to initiate a file upload; the ESMCustomMgr::OnUploadComplete() method is invoked automatically when the upload is complete.

View solution in original post

5 REPLIES 5

Hi Lakshmanan

I do not have full knowledge of your current deployment but assuming you are using Axeda Agent you can upload files using agent's File Watcher capability. File Watcher can observe individual files or folders and when the file content or timestamp changes it can upload the file to the platform. Secondly, you can instruct the File Watcher to delete the file once it has been sent to the platform. This is done by setting the Transient option in the File Watcher dialog.

FileWatcher.png

Here is what Builder's help has to offer on the Transient settings:


Transient
If selected, when the file watcher runs, all watched files are processed and then deleted from the device. If not selected (non-transient), when the file watcher runs, the Axeda Agent processes only watched files that have changed (based on the selected Compare Method) since the last time the file watcher ran; no watched files are deleted from the device. (For non-transient file watchers, the first time file watcher runs, all watched files are processed.)


I hope this helps

Maciej

HI Maciej,

Thank you for your reply and interest to help me.

My deployment approach is as follows- Modem on the device is always off,

whenever the device has to upload the log files, the modem needs to be

switched on and after the upload of log-files is completed the modem needs

to be switched off.

The modem switch on and off is controlled by "Interprocess communication"

by placing specific files in specific directories for 2 components to

interoperate for switching on/off.

After a successful upload of a log-file, the agent should provide control

to the "Custom handler" for switching off the modem. There is no specific

hookpoint interfaces in the custom handler SDK for successful upload of a

file. Is there is a workaround to this problem?

Regards, Lakshman

Hi Lakshman,

You might also want to take a look at Logic Schemas and Scripts in the Agent. Logic schemas are pretty much rules where a certain event, a trigger, will cause an action to happen in the agent. For example, there's a "Enterprise Queue Empty" trigger that will fire if all messages are sent to the enterprise, that could turn off your modem. Custom triggers and actions could be developed that are compatible with logic schemas...

Scripts are exactly what they sound like, bits of scripting code that will execute actions. They can be triggered from logic schemas or other parts of the agent. They provide an upload file directive that functions similar to a file watcher. They will also allow external scripts (bat, sh, py etc) to be called.

One possible work around for all of this is to have the following flow:

Assumptions: The filewatcher has the Transient option enabled.

1. Modem is powered, Agent comes on line

2. Agent loads all files/data items etc. into it's enterprise queue

3. A script starts looking at the file watcher directory

4. Agent continues sending files until complete

5. The script sees the empty directory and can set a timer

6. When the timer is complete Agent commands the modem to shut down.

Another option is to handle this at the platform side with expression rules and a custom object.  When a file is uploaded, check if it's one of the files that should turn off the modem.  If yes, create a package with the instruction to delete the file you want to delete and then schedule a deployment for the device in question.

Dmitriy Khodos might know about the agent-side hooks

The Custom Handler API lacks support for notification on upload completion. For your use case, consider creating a Custom Component instead of Custom Handler. For an example of a custom component that carries out file upload, see CustomComponent/SampleComponents/SMExample in the Agent SDK directory. In that example, the ESMCustomMgr::FileUploadExample() method demonstrates how to initiate a file upload; the ESMCustomMgr::OnUploadComplete() method is invoked automatically when the upload is complete.

Top Tags