Thanks Uli I think you are right, there are still locked resources when the define code runs.
Since we are using the Java API I added code lines to setLockMode() & setLockwaitMode() on the Tamino connection to make it wait for resources to become available rather than crashing out. Sometimes this takes a couple of minutes. Here is the code for the define schema.
TConnection conn = TConnectionFactory.getInstance().newConnection(dburi);
conn.setLockMode(TLockMode.PROTECTED);
conn.setLockwaitMode(TLockwaitMode.YES);
TSchemaDefinition3Accessor tsd3Accessor = conn.newSchemaDefinition3Accessor(TStreamObjectModel.getInstance());
TXMLObject object = TXMLObject.newInstance(new File(fileName));
tsd3Accessor.define(object);
conn.close();
Here’s the code I used for the undefine.
TConnection conn = TConnectionFactory.getInstance().newConnection(dburi);
conn.setLockMode(TLockMode.PROTECTED);
conn.setLockwaitMode(TLockwaitMode.YES);
TSchemaDefinition3Accessor tsd3Accessor = conn.newSchemaDefinition3Accessor(TStreamObjectModel.getInstance());
tsd3Accessor.undefine(collection,schema);
conn.close();
Our programs runs in the early hours of the morning and we’re not phased about them occasionally waiting around for a few minutes, so we’re happy with this solution.
Many thanks for your help.
#API-Management#webMethods#Tamino