cancel
Showing results for 
Search instead for 
Did you mean: 

file adapter operating system command exit code

Former Member
0 Kudos

Hello,

If you call an operating system command in the file adapter, how is the exit code of the command handled? The documentation says nothing about this.

If I call 'true', I expect the file adapter to succeed.

If I call 'false', I expect the file adapter to fail.

Hope someone can calrify.

Best regards

/Otto Frost

Accepted Solutions (1)

Accepted Solutions (1)

moorthy
Active Contributor
0 Kudos

Hi,

I am not sure about any feature is available..

This blog may help u to debug the OS commands- /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching

But even you can think of configuring Alert for the Adapter engine errors

Regards,

Moorthy

Former Member
0 Kudos

Otto

The script called in the file adapter can be any windows/dos/unix/solaris scripts depending on the OS on which XI is deployed.So expecting the FileAdapter to respond to a custom status return from the script may be unfeasible.Instead log the error from script to a new log file and handle it withing a BPM using a separate Error handler.This is just one possible option.There are crazier ways to intimate XI on this error but may not be production acceptable!!

Answers (1)

Answers (1)

Former Member
0 Kudos

I've been working with AMTrix before, where exit codes were treated correctly, and not just ignored. In AMTrix you may treat the exit codes in any way you like, or ignore them. For example, you may treat exit code 0 as success, you may treat 0 as failure, depending on the setup.

In windows and unix exits codes works in a very similar way, and I suppose > 90% of the XI installations are on windows or unix, so it would make sense to be able to deal with the exit codes in a good way. Ignoring the exit code is not what you want in most cases.

If the exit code works differently on different platforms, you need different solutions.

Former Member
0 Kudos

Otto

Am afraid havent worked with Amtrix but as I understand most EAI including Tibco spawn a shell command which runs as an independent instance on which the EAI session wont have much control.If there were a mechanism for the file adapter exit(used for executing the shell) to trap the error statuses, this can be incorporated.If you have a suggestion pls do let the forum know how this is possible.May be it can be a good feedback for the XI Development team in SAP.

Former Member
0 Kudos

Hi, Yes, you are rigth, it spawns a subprocess, that runs without control.

In java you use Runtime.exec().

It returns a process.

process.exitValue() returns an int.

The process is already used to terminate the process after timeout I suppose.

You would like to be able to have the fileadapter succeed or fail depending on this exitValue.

Depending on the command you execute, the exit code is different. RTFM on unix.

You would like to define which codes should be treated as success, and which ones that should be treated as failure.

true typically returns 0 and false not 0

However, a comparison command could for example return 0 for equal, -1 if the frist argument is smaller and 1 if the first argument is larger.

For the diff command, Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.

Thanks

/Otto

Former Member
0 Kudos

Otto

Thats quite understandable behavior but as you can see from your own response that the Key Challenge is in Getting the EAI session to know Response back, is there a resolution we can suggest/follow??

Last time I had this problem, one workaround my developers had was to provide HTTP responses async(thro module) to BPM for error handling.Though it works fine as of today in Prod, I still felt there has to be a workaround but havent seen any forthcoming..

Former Member
0 Kudos

Hello,

I think BPM is a possible soluiton. However, it makes it much more complex.

I think SAP should add handling of exit code to the file adapter.

The file adapter knows how to handle errors like login failure, missing directory to write to, server not found in dns etcetera. Exit code with failure status should be handled in the same manner I suppose.

Best regards /Otto