public class OptionRule extends Object
Option.
The option rule is typically built in one of the following pattern:
// simple rule
OptionRule simpleRule = OptionRule.builder()
.optional(POLL_TIMEOUT, POLL_INTERVAL)
.required(CLIENT_SERVICE_URL)
.build();
// basic full rule
OptionRule fullRule = OptionRule.builder()
.optional(POLL_TIMEOUT, POLL_INTERVAL, CURSOR_STARTUP_MODE)
.required(CLIENT_SERVICE_URL, ADMIN_SERVICE_URL)
.exclusive(TOPIC_PATTERN, TOPIC)
.conditional(CURSOR_STARTUP_MODE, StartMode.TIMESTAMP, CURSOR_STARTUP_TIMESTAMP)
.build();
// complex conditional rule
// moot expression
Expression expression = Expression.of(TOPIC_DISCOVERY_INTERVAL, 200)
.and(Expression.of(Condition.of(CURSOR_STARTUP_MODE, StartMode.EARLIEST)
.or(CURSOR_STARTUP_MODE, StartMode.LATEST)))
.or(Expression.of(Condition.of(TOPIC_DISCOVERY_INTERVAL, 100)))
OptionRule complexRule = OptionRule.builder()
.optional(POLL_TIMEOUT, POLL_INTERVAL, CURSOR_STARTUP_MODE)
.required(CLIENT_SERVICE_URL, ADMIN_SERVICE_URL)
.exclusive(TOPIC_PATTERN, TOPIC)
.conditional(expression, CURSOR_RESET_MODE)
.build();
| 限定符和类型 | 类和说明 |
|---|---|
static class |
OptionRule.Builder
Builder for
OptionRule. |
public List<RequiredOption> getRequiredOptions()
public static OptionRule.Builder builder()
Copyright © 2024 The Apache Software Foundation. All rights reserved.