Search in sources :

Example 1 with Type

use of org.apache.kafka.common.config.ConfigResource.Type in project kafka by apache.

the class ConfigurationControlManager method replay.

/**
 * Apply a configuration record to the in-memory state.
 *
 * @param record            The ConfigRecord.
 */
public void replay(ConfigRecord record) {
    Type type = Type.forId(record.resourceType());
    ConfigResource configResource = new ConfigResource(type, record.resourceName());
    TimelineHashMap<String, String> configs = configData.get(configResource);
    if (configs == null) {
        configs = new TimelineHashMap<>(snapshotRegistry, 0);
        configData.put(configResource, configs);
    }
    if (record.value() == null) {
        configs.remove(record.name());
    } else {
        configs.put(record.name(), record.value());
    }
    if (configs.isEmpty()) {
        configData.remove(configResource);
    }
    log.info("{}: set configuration {} to {}", configResource, record.name(), record.value());
}
Also used : OpType(org.apache.kafka.clients.admin.AlterConfigOp.OpType) Type(org.apache.kafka.common.config.ConfigResource.Type) ConfigResource(org.apache.kafka.common.config.ConfigResource)

Aggregations

OpType (org.apache.kafka.clients.admin.AlterConfigOp.OpType)1 ConfigResource (org.apache.kafka.common.config.ConfigResource)1 Type (org.apache.kafka.common.config.ConfigResource.Type)1