04-16-2024 10:34 AM
Hi,
Maapi.commitQueueResult is deprecated and we should use applyTransParams.
I need help on how to use applyTransParams.
I have the following code:
CommitParams cp = new CommitParams();
cp.setCommitQueueSync();
cp.setNoOverwrite();
CommitQueueResult result = (CommitQueueResult)maapi.applyTransParams(th, false, cp);
For service create and delete, the code works fine.
However, when I do a change on the service with zero-delta (which means no change at all), I got the following error:
com.tailf.maapi.ApplyResult cannot be cast to com.tailf.maapi.CommitQueueResult
I have to use the deprecated Maapi.commitQueueResult, which works fine.
Does anyone have the same issue?
THX
sm000x
Solved! Go to Solution.
04-22-2024 06:26 AM
The applyTransParams() method returns a CommitQueueResult object only if a commit through the commit queue was requested:
https://pubhub.devnetcloud.com/media/nso-api-6.2/docs/java/com/tailf/maapi/Maapi.html#applyTransParams(int,boolean,com.tailf.maapi.CommitParams)
In your case you get an ApplyResult object returned, since the zero-delta commit is not applying anything to the queue. So you would need to verify that the object returned by applyTransParams is an instance of CommitQueueResult, before casting it.
04-22-2024 06:26 AM
The applyTransParams() method returns a CommitQueueResult object only if a commit through the commit queue was requested:
https://pubhub.devnetcloud.com/media/nso-api-6.2/docs/java/com/tailf/maapi/Maapi.html#applyTransParams(int,boolean,com.tailf.maapi.CommitParams)
In your case you get an ApplyResult object returned, since the zero-delta commit is not applying anything to the queue. So you would need to verify that the object returned by applyTransParams is an instance of CommitQueueResult, before casting it.
04-22-2024 06:34 AM
Hi, Hazad:
Thank you so much. This is really helpful.
THX
sm000x
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide