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

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
JelteDeJong
370 Views, 3 Replies

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

JelteDeJong
Mentor
Mentor

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

0 Likes

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

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

Markus.Koechl
Autodesk
Autodesk
Accepted solution

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
0 Likes

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 4
JelteDeJong
in reply to: Markus.Koechl

JelteDeJong
Mentor
Mentor

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

0 Likes

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

Message 4 of 4
m_baczewski
in reply to: JelteDeJong

m_baczewski
Advocate
Advocate
@JelteDeJong
Hi,

Do you remember what was the reason that you received the error: "The RPC server is unavailable" on the second execution of the task? I have exactly the same problem: after starting the job processor, the task executes correctly, but if I add it again, it won’t execute and throws this error.
0 Likes

@JelteDeJong
Hi,

Do you remember what was the reason that you received the error: "The RPC server is unavailable" on the second execution of the task? I have exactly the same problem: after starting the job processor, the task executes correctly, but if I add it again, it won’t execute and throws this error.

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

Post to forums  

Autodesk Design & Make Report