# Store and Forward Automatic Retry

**URL:** <https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [December 6, 2021, 10:42am UTC](https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787 "2021-12-06T10:42:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [December 6, 2021, 10:42am UTC](https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787/1 "2021-12-06T10:42:18Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 6, 2021, 11:35am UTC](https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787/2 "2021-12-06T11:35:46Z")

</div>

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)](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)

```auto
	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)

```

---

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [January 13, 2022, 9:35am UTC](https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787/3 "2022-01-13T09:35:11Z")

</div>

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:

````auto
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?
````

---

<div class="post-metadata">

**Author:** ![jon.mohler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jon.mohler/32/20043_2.png) [@jon.mohler](https://forum.inductiveautomation.com/u/jon.mohler)\
**Post date:** [June 15, 2022, 1:12pm UTC](https://forum.inductiveautomation.com/t/store-and-forward-automatic-retry/53787/4 "2022-06-15T13:12:20Z")

</div>

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

```auto
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)

```
