Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom job "Execute(...)" is called 2 times after Failure

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
JelteDeJong
275 Views, 2 Replies

Custom job "Execute(...)" is called 2 times after Failure

When an exception is thrown by the code I catch it and write the message to the log. Then I return a failure to the server. something like this:

 

public ACJE.JobOutcome Execute(ACJE.IJobProcessorServices context, ACJE.IJob job)
{
try
{
    // Fail for some reason here
    Throw new exception()            
}
catch (Exception ee)
{
    context.Log("Exception while generating. msg: " + ee.Message, ACJE.MessageType.eError);
    return ACJE.JobOutcome.Failure;
}
}

 

My problem starts when the Execcute(...) method is called a 2e time. Then I get an axception:

System.Runtime.InteropServices.COMException: 'The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)'

When I call:

_inventor.ApplicationAddIns.get_ItemById("{fc7e397d-6e67-4b0d-a4e1-82adf2d692d0}");

(which works fine the 1e time)

This exception is also handled but it will overwrite the original log message with the original exception message.  This makes error handling in production much hared because I never see the original message.

 

is there some way to detect that the Execcute(...) method is called a 2e time?

Or is there a way to preserve the original log message?

 

Edit: 
I found a bug in the code that results in the "The RPC server is unavailable. " exception on the second run. So that is not a problem. but I still would like answers to my questions about detecting a second call of the Execcute(...) method.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

2 REPLIES 2
Message 2 of 3
Markus.Koechl
in reply to: JelteDeJong

Hi @JelteDeJong, I am not sure I understood your point or problem. Is the second execution related to the Job retry setting enabled? If so, you need to evaluate the retry parameter "RetriesCount"/"Value" of the Job Parameter array.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
Message 3 of 3
JelteDeJong
in reply to: Markus.Koechl

I did not know about this setting. But I found it and I expect that this is why a job is called a 2e time.

JelteDeJong_0-1717056210080.png

I also found the parameter and could solve my issue.  

JelteDeJong_1-1717057350169.png

 

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report