Store and Forward Automatic Retry

Hi,

I am looking for a way to get the store and forward engine to automatically retry.

We use the Canary module to send data our historian. When the target sender service is unavailable, such as during a version upgrade, I have to manually retry to get the quarantined items to send. This has to be done for each history provider.

While it doesn’t happen a lot, it is still quite cumbersome.

Is there a way to get the store and forward engine to automatically retry, or a way to script a store and forward to retry? I did not see any handy system tags or anything in the documentation.

Thanks,

I dont have a handy way of triggering a quarantie atm but

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/gateway/history/HistoryManager.html#unquarantineData(java.lang.String,java.util.List)

should do the trick.

try this (i couldnt test it as i have nothing quarentined)

	from com.inductiveautomation.ignition.gateway import IgnitionGateway
	
	gateway = IgnitionGateway.get()	
	histMngr = gateway.getHistoryManager()
	
	stores = histMngr.getStores(None)	 #none = getAll
	for store in stores:
		qdataInfo = histMngr.getQuarantinedDataInfo(store)
		ids = [x.getId() for x in qdataInfo]		
		if ids:
			histMngr.unquarantineData(store,ids)

Sorry, I’ve been distracted.

I tried this code without success. Most times the script does not complete, no error though. I changed the code to delete the quarantined data, also without success. I inconsistently get the error below:

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 25, in valueChanged at com.inductiveautomation.ignition.gateway.history.stores.AbstractDatasourceStore.runQuarantineQueryForIds(AbstractDatasourceStore.java:835) at com.inductiveautomation.ignition.gateway.history.stores.AbstractDatasourceStore.deleteQuarantinedData(AbstractDatasourceStore.java:827) at com.inductiveautomation.ignition.gateway.history.HistoryManagerImpl.deleteQuarantinedData(HistoryManagerImpl.java:579) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.ClassCastException: java.lang.ClassCastException: class java.math.BigInteger cannot be cast to class java.lang.Long (java.math.BigInteger and java.lang.Long are in module java.base of loader 'bootstrap')

at org.python.core.Py.JavaError(Py.java:547)

at org.python.core.Py.JavaError(Py.java:538)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208)

at org.python.core.PyObject.__call__(PyObject.java:494)

at org.python.core.PyObject.__call__(PyObject.java:498)

at org.python.core.PyMethod.__call__(PyMethod.java:156)

at org.python.pycode._pyx29646.valueChanged$1(:27)

at org.python.pycode._pyx29646.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:173)

at org.python.core.PyBaseCode.call(PyBaseCode.java:306)

at org.python.core.PyFunction.function___call__(PyFunction.java:474)

at org.python.core.PyFunction.__call__(PyFunction.java:469)

at org.python.core.PyFunction.__call__(PyFunction.java:464)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:831)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:813)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:702)

at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$FunctionInvokerImpl.run(TagScriptManagerImpl.java:533)

at com.inductiveautomation.ignition.gateway.tags.scripting.events.AbstractTagScript.invoke(AbstractTagScript.java:34)

at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$Task.invoke(TagScriptManagerImpl.java:482)

at com.inductiveautomation.ignition.gateway.tags.scripting.TagScriptManagerImpl$TagScriptDispatcher.run(TagScriptManagerImpl.java:445)

at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:539)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.python.core.PyException: java.lang.ClassCastException: java.lang.ClassCastException: class java.math.BigInteger cannot be cast to class java.lang.Long (java.math.BigInteger and java.lang.Long are in module java.base of loader 'bootstrap')

... 28 common frames omitted

Caused by: java.lang.ClassCastException: class java.math.BigInteger cannot be cast to class java.lang.Long (java.math.BigInteger and java.lang.Long are in module java.base of loader 'bootstrap')

at com.inductiveautomation.ignition.gateway.history.stores.AbstractDatasourceStore.runQuarantineQueryForIds(AbstractDatasourceStore.java:835)

at com.inductiveautomation.ignition.gateway.history.stores.AbstractDatasourceStore.deleteQuarantinedData(AbstractDatasourceStore.java:827)

at com.inductiveautomation.ignition.gateway.history.HistoryManagerImpl.deleteQuarantinedData(HistoryManagerImpl.java:579)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.base/java.lang.reflect.Method.invoke(Unknown Source)

at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)

... 25 common frames omitted```

Any idea what can cause this?

Try with converting the data info ID to a Long. This worked for me (slightly different script as I was doing it in 7.9, but looks like this is the issue you’re having

from com.inductiveautomation.ignition.gateway import IgnitionGateway
from java.lang import Long  

gateway = IgnitionGateway.get()	
histMngr = gateway.getHistoryManager()
	
stores = histMngr.getStores(None)	 #none = getAll
for store in stores:
	qdataInfo = histMngr.getQuarantinedDataInfo(store)
	ids = [Long(x.getId()) for x in qdataInfo]		
	if ids:
		histMngr.unquarantineData(store,ids)
1 Like