Search in sources :

Example 1 with ConsistentRegionContext

use of com.ibm.streams.operator.state.ConsistentRegionContext in project streamsx.kafka by IBMStreams.

the class AbstractKafkaProducerOperator method checkConsistentRegion.

@ContextCheck(compile = true)
public static void checkConsistentRegion(OperatorContextChecker checker) {
    // check that the operator is not the start of the consistent region
    OperatorContext opContext = checker.getOperatorContext();
    ConsistentRegionContext crContext = opContext.getOptionalContext(ConsistentRegionContext.class);
    if (crContext != null) {
        if (crContext.isStartOfRegion()) {
            // //$NON-NLS-1$
            checker.setInvalidContext(Messages.getString("PRODUCER_NOT_START_OF_CONSISTENT_REGION"), new Object[0]);
        }
    }
}
Also used : ConsistentRegionContext(com.ibm.streams.operator.state.ConsistentRegionContext) OperatorContext(com.ibm.streams.operator.OperatorContext) ContextCheck(com.ibm.streams.operator.OperatorContext.ContextCheck)

Example 2 with ConsistentRegionContext

use of com.ibm.streams.operator.state.ConsistentRegionContext in project streamsx.topology by IBMStreams.

the class FunctionalOpUtils method checkNotConsistentRegionSource.

/**
     * Verify a functional operator is not the start of a consistent region.
     * @param checker Context checker.
     */
static void checkNotConsistentRegionSource(OperatorContextChecker checker) {
    OperatorContext context = checker.getOperatorContext();
    ConsistentRegionContext crc = context.getOptionalContext(ConsistentRegionContext.class);
    if (crc == null)
        return;
    if (crc.isStartOfRegion() || crc.isTriggerOperator())
        checker.setInvalidContext(Messages.getString("CONSISTENT_CHECK_1"), new String[] { context.getKind() });
}
Also used : ConsistentRegionContext(com.ibm.streams.operator.state.ConsistentRegionContext) OperatorContext(com.ibm.streams.operator.OperatorContext)

Aggregations

OperatorContext (com.ibm.streams.operator.OperatorContext)2 ConsistentRegionContext (com.ibm.streams.operator.state.ConsistentRegionContext)2 ContextCheck (com.ibm.streams.operator.OperatorContext.ContextCheck)1