Question & Answer
Question
When working with custom agents, different query timeouts for SQL clauses can be used to improve performance. One common way is to set the queryTimeout property in customer_overrides.properties, but there are even more ways to do that.
Answer
1. Setting queryTimeout in customer_overrides.properties
The property is set in the following format:
yfs.<TRANSACTION_KEY>.queryTimeoutFor custom agents, <TRANSACTION_KEY> mostly is a timestamp like 20140930151908936763 and can be found in the agent's Message XML, for example:
<Message FlowName="MY_CUSTOM_AGENT" TransactionKey="20140930151908936763">
<AgentDetails>
<MessageXml ... />
</AgentDetails>
</Message>
In this example, the property would be set as:
yfs.20140930151908936763.queryTimeout=120
2. Setting queryTimeout in the agent configuration XML
The property can also be set in the Message XML itself. Go to your custom agent transaction > Agent Criteria Details > Criteria Parameters tab. Add a new parameter:
Parameter Name: QueryTimeout
Parameter Value: <your timeout value in seconds>
The Message XML will contain this additional XML attribute which is read by the agent server code:
<Message FlowName="MY_CUSTOM_AGENT" TransactionKey="20140930151908936763">
<AgentDetails>
<MessageXml QueryTimeout="120" ... />
</AgentDetails>
</Message>
3. Setting queryTimeout programmatically
The query timeout can also be set in the YFSEnvironment handle in the custom code as follows:
public void executeJob(YFSEnvironment env, Document arg1) throws Exception {
YCPContext ctx = (YCPContext)env;
ctx.setQueryTimeout(120);
Please note that the query timeout value is set during the agent server startup and cannot be reset during the run of the agent. The agent server has to be restarted for the change to take effect.
Was this topic helpful?
Document Information
Modified date:
10 May 2022
UID
swg21684696