public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(SYSTEM_CONFIG_KEY, streamId), getSystemName()); this.physicalNameOptional.ifPresent(physicalName -> configs.put(String.format(PHYSICAL_NAME_CONFIG_KEY, streamId), physicalName)); this.streamConfigs.forEach((key, value) -> configs.put(String.format(STREAM_CONFIGS_CONFIG_KEY, streamId, key), value)); return Collections.unmodifiableMap(configs); } }
@Override public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamId = getStreamId(); this.offsetDefaultOptional.ifPresent(od -> configs.put(String.format(OFFSET_DEFAULT_CONFIG_KEY, streamId), od.name().toLowerCase())); this.resetOffsetOptional.ifPresent(resetOffset -> configs.put(String.format(RESET_OFFSET_CONFIG_KEY, streamId), Boolean.toString(resetOffset))); this.priorityOptional.ifPresent(priority -> configs.put(String.format(PRIORITY_CONFIG_KEY, streamId), Integer.toString(priority))); this.isBootstrapOptional.ifPresent(bootstrap -> configs.put(String.format(BOOTSTRAP_CONFIG_KEY, streamId), Boolean.toString(bootstrap))); this.isBoundedOptional.ifPresent(bounded -> configs.put(String.format(BOUNDED_CONFIG_KEY, streamId), Boolean.toString(bounded))); this.deleteCommittedMessagesOptional.ifPresent(deleteCommittedMessages -> configs.put(String.format(DELETE_COMMITTED_MESSAGES_CONFIG_KEY, streamId), Boolean.toString(deleteCommittedMessages))); return Collections.unmodifiableMap(configs); } }
/** * Constructs a {@link StreamDescriptor} instance. * * @param streamId id of the stream * @param serde serde for messages in the stream * @param systemDescriptor system descriptor this stream descriptor was obtained from */ StreamDescriptor(String streamId, Serde serde, SystemDescriptor systemDescriptor) { Preconditions.checkArgument(systemDescriptor != null, String.format("SystemDescriptor must not be null. streamId: %s", streamId)); String systemName = systemDescriptor.getSystemName(); Preconditions.checkState(isValidStreamId(streamId), String.format("streamId must be non-empty and must not contain spaces or special characters. " + "streamId: %s, systemName: %s", streamId, systemName)); Preconditions.checkArgument(serde != null, String.format("Serde must not be null. streamId: %s systemName: %s", streamId, systemName)); this.streamId = streamId; this.serde = serde; this.systemDescriptor = systemDescriptor; }
@Override public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(super.toConfig()); String streamId = getStreamId(); this.offsetDefaultOptional.ifPresent(od -> configs.put(String.format(OFFSET_DEFAULT_CONFIG_KEY, streamId), od.name().toLowerCase())); this.resetOffsetOptional.ifPresent(resetOffset -> configs.put(String.format(RESET_OFFSET_CONFIG_KEY, streamId), Boolean.toString(resetOffset))); this.priorityOptional.ifPresent(priority -> configs.put(String.format(PRIORITY_CONFIG_KEY, streamId), Integer.toString(priority))); this.isBootstrapOptional.ifPresent(bootstrap -> configs.put(String.format(BOOTSTRAP_CONFIG_KEY, streamId), Boolean.toString(bootstrap))); this.isBoundedOptional.ifPresent(bounded -> configs.put(String.format(BOUNDED_CONFIG_KEY, streamId), Boolean.toString(bounded))); this.deleteCommittedMessagesOptional.ifPresent(deleteCommittedMessages -> configs.put(String.format(DELETE_COMMITTED_MESSAGES_CONFIG_KEY, streamId), Boolean.toString(deleteCommittedMessages))); return Collections.unmodifiableMap(configs); } }
/** * Constructs a {@link StreamDescriptor} instance. * * @param streamId id of the stream * @param serde serde for messages in the stream * @param systemDescriptor system descriptor this stream descriptor was obtained from */ StreamDescriptor(String streamId, Serde serde, SystemDescriptor systemDescriptor) { Preconditions.checkArgument(systemDescriptor != null, String.format("SystemDescriptor must not be null. streamId: %s", streamId)); String systemName = systemDescriptor.getSystemName(); Preconditions.checkState(isValidStreamId(streamId), String.format("streamId must be non-empty and must not contain spaces or special characters. " + "streamId: %s, systemName: %s", streamId, systemName)); Preconditions.checkArgument(serde != null, String.format("Serde must not be null. streamId: %s systemName: %s", streamId, systemName)); this.streamId = streamId; this.serde = serde; this.systemDescriptor = systemDescriptor; }
public Map<String, String> toConfig() { HashMap<String, String> configs = new HashMap<>(); configs.put(String.format(SYSTEM_CONFIG_KEY, streamId), getSystemName()); this.physicalNameOptional.ifPresent(physicalName -> configs.put(String.format(PHYSICAL_NAME_CONFIG_KEY, streamId), physicalName)); this.streamConfigs.forEach((key, value) -> configs.put(String.format(STREAM_CONFIGS_CONFIG_KEY, streamId, key), value)); return Collections.unmodifiableMap(configs); } }