Using "Store and Forward" mechanism from a module (driver)


I have a OPC-UA driver that creates an OPC-UA tag tree, but also writes some data to a database. Now I am doing the writing through the SRConnection.runPrepQuery … I wonder if its possible to use the Ignition “Store and Forward” functionality instead. If it’s possible, a short hint would be highly appreciated.


You need to use the history manager to store information through the store and forward. First you need to create a class that implements DatasourceData:

[code]public class QuerySFData implements DatasourceData {
private static final long serialVersionUID = 1L;

    String query;
    String datasource;
    Object[] values;

    public QuerySFData(String query, String datasource) {
            this(query, null, datasource);

    public QuerySFData(String query, Object[] values, String datasource) {
            this.query = query;
            this.values = values;
            this.datasource = datasource;

    public int getDataCount() {
            return 1;

    public HistoryFlavor getFlavor() {
            return DatasourceData.FLAVOR;

    public String getLoggerName() {
            return "Client Store & Forward";

    public String getSignature() {
            return "SFQuery: " + datasource + " - " + query;

    public void storeToConnection(SRConnection conn) throws Exception {
            if (values != null) {
                    conn.runPrepUpdate(query, values);
            } else {


Then you just call:

context.getHistoryManager().storeHistory("YourDataSourceName", new QuerySFData(query, values, datasource));