Search in sources :

Example 1 with EventProcessorMarker

use of com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker in project concord by walmartlabs.

the class EventMarkerDao method get.

public EventMarker get(String processorName) {
    EventProcessorMarker m = EVENT_PROCESSOR_MARKER.as("m");
    Long currentEventSeq = txResult(tx -> tx.select(m.EVENT_SEQ).from(m).where(m.PROCESSOR_NAME.eq(processorName)).fetchOne(m.EVENT_SEQ));
    Long maxEventSeq = txResult(tx -> tx.select(max(PROCESS_EVENTS.EVENT_SEQ)).from(PROCESS_EVENTS).fetchOne(Record1::value1));
    return EventMarker.builder().eventSeq(currentEventSeq != null ? currentEventSeq : -1).maxEventSeq(maxEventSeq != null ? maxEventSeq : -1).build();
}
Also used : EventProcessorMarker(com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker)

Example 2 with EventProcessorMarker

use of com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker in project concord by walmartlabs.

the class EventMarkerDao method update.

public void update(DSLContext tx, String processorName, long eventSeq) {
    EventProcessorMarker m = EVENT_PROCESSOR_MARKER.as("m");
    tx.insertInto(m).columns(m.PROCESSOR_NAME, m.EVENT_SEQ).values(value(processorName), value(eventSeq)).onDuplicateKeyUpdate().set(m.EVENT_SEQ, eventSeq).where(m.PROCESSOR_NAME.eq(processorName)).execute();
}
Also used : EventProcessorMarker(com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker)

Example 3 with EventProcessorMarker

use of com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker in project concord by walmartlabs.

the class EventMarkerDao method get.

@WithTimer
public EventMarker get(String processorName) {
    EventProcessorMarker m = Tables.EVENT_PROCESSOR_MARKER.as("m");
    Long currentEventSeq = txResult(tx -> tx.select(m.EVENT_SEQ).from(m).where(m.PROCESSOR_NAME.eq(processorName)).fetchOne(m.EVENT_SEQ));
    Long maxEventSeq = txResult(tx -> tx.select(max(PROCESS_EVENTS.EVENT_SEQ)).from(PROCESS_EVENTS).fetchOne(Record1::value1));
    return EventMarker.builder().eventSeq(currentEventSeq != null ? currentEventSeq : -1).maxEventSeq(maxEventSeq != null ? maxEventSeq : -1).build();
}
Also used : EventProcessorMarker(com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker) WithTimer(com.walmartlabs.concord.server.sdk.metrics.WithTimer)

Example 4 with EventProcessorMarker

use of com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker in project concord by walmartlabs.

the class EventMarkerDao method update.

@WithTimer
public void update(DSLContext tx, String processorName, long eventSeq) {
    EventProcessorMarker m = Tables.EVENT_PROCESSOR_MARKER.as("m");
    tx.insertInto(m).columns(m.PROCESSOR_NAME, m.EVENT_SEQ).values(value(processorName), value(eventSeq)).onDuplicateKeyUpdate().set(m.EVENT_SEQ, eventSeq).where(m.PROCESSOR_NAME.eq(processorName)).execute();
}
Also used : EventProcessorMarker(com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker) WithTimer(com.walmartlabs.concord.server.sdk.metrics.WithTimer)

Aggregations

EventProcessorMarker (com.walmartlabs.concord.server.jooq.tables.EventProcessorMarker)4 WithTimer (com.walmartlabs.concord.server.sdk.metrics.WithTimer)2