Search in sources :

Example 1 with DataEvent

use of org.jumpmind.symmetric.model.DataEvent in project symmetric-ds by JumpMind.

the class DataService method insertDataEventAndOutgoingBatch.

protected long insertDataEventAndOutgoingBatch(ISqlTransaction transaction, long dataId, String channelId, String nodeId, DataEventType eventType, String routerId, boolean isLoad, long loadId, String createBy, Status status, String tableName) {
    OutgoingBatch outgoingBatch = new OutgoingBatch(nodeId, channelId, status);
    outgoingBatch.setLoadId(loadId);
    outgoingBatch.setCreateBy(createBy);
    outgoingBatch.setLoadFlag(isLoad);
    outgoingBatch.incrementEventCount(eventType);
    if (tableName != null) {
        outgoingBatch.incrementTableCount(tableName.toLowerCase());
    }
    if (status == Status.RQ) {
        outgoingBatch.setExtractJobFlag(true);
    }
    engine.getOutgoingBatchService().insertOutgoingBatch(transaction, outgoingBatch);
    insertDataEvent(transaction, new DataEvent(dataId, outgoingBatch.getBatchId(), routerId));
    return outgoingBatch.getBatchId();
}
Also used : OutgoingBatch(org.jumpmind.symmetric.model.OutgoingBatch) DataEvent(org.jumpmind.symmetric.model.DataEvent)

Example 2 with DataEvent

use of org.jumpmind.symmetric.model.DataEvent in project symmetric-ds by JumpMind.

the class ChannelRouterContext method addDataEvent.

public void addDataEvent(long dataId, long batchId, String routerId) {
    dataEventsToSend.add(new DataEvent(dataId, batchId, routerId));
    if (dataId != lastDataId) {
        dataIds.add(dataId);
        lastDataId = dataId;
    }
}
Also used : DataEvent(org.jumpmind.symmetric.model.DataEvent)

Example 3 with DataEvent

use of org.jumpmind.symmetric.model.DataEvent in project symmetric-ds by JumpMind.

the class DataService method insertDataEvents.

public void insertDataEvents(ISqlTransaction transaction, final List<DataEvent> events) {
    if (events.size() > 0) {
        transaction.prepare(getSql("insertIntoDataEventSql"));
        for (DataEvent dataEvent : events) {
            String routerId = dataEvent.getRouterId();
            transaction.addRow(dataEvent, new Object[] { dataEvent.getDataId(), dataEvent.getBatchId(), StringUtils.isBlank(routerId) ? Constants.UNKNOWN_ROUTER_ID : routerId }, new int[] { Types.NUMERIC, Types.NUMERIC, Types.VARCHAR });
        }
        transaction.flush();
    }
}
Also used : DataEvent(org.jumpmind.symmetric.model.DataEvent)

Aggregations

DataEvent (org.jumpmind.symmetric.model.DataEvent)3 OutgoingBatch (org.jumpmind.symmetric.model.OutgoingBatch)1