You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2019/09/27 22:51:27 UTC

[GitHub] [samza] cameronlee314 commented on a change in pull request #1171: SAMZA-2328: StreamConfig from scala to Java

cameronlee314 commented on a change in pull request #1171: SAMZA-2328: StreamConfig from scala to Java
URL: https://github.com/apache/samza/pull/1171#discussion_r329275775
 
 

 ##########
 File path: samza-core/src/main/scala/org/apache/samza/config/StreamConfig.java
 ##########
 @@ -0,0 +1,394 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.samza.config;
+
+import com.google.common.collect.Sets;
+import org.apache.samza.system.SystemStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.invoke.MethodHandles;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class StreamConfig extends MapConfig {
+  public static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+
+  // Samza configs for streams
+  public static final String SAMZA_PROPERTY = "samza.";
+  public static final String SYSTEM = SAMZA_PROPERTY + "system";
+  public static final String PHYSICAL_NAME = SAMZA_PROPERTY + "physical.name";
+  public static final String MSG_SERDE = SAMZA_PROPERTY + "msg.serde";
+  public static final String KEY_SERDE = SAMZA_PROPERTY + "key.serde";
+  public static final String CONSUMER_RESET_OFFSET = SAMZA_PROPERTY + "reset.offset";
+  public static final String CONSUMER_OFFSET_DEFAULT = SAMZA_PROPERTY + "offset.default";
+  public static final String BOOTSTRAP = SAMZA_PROPERTY + "bootstrap";
+  public static final String PRIORITY = SAMZA_PROPERTY + "priority";
+  public static final String IS_INTERMEDIATE = SAMZA_PROPERTY + "intermediate";
+  public static final String DELETE_COMMITTED_MESSAGES = SAMZA_PROPERTY + "delete.committed.messages";
+  public static final String IS_BOUNDED = SAMZA_PROPERTY + "bounded";
+  public static final String BROADCAST = SAMZA_PROPERTY + "broadcast";
+
+  // We don't want any external dependencies on these patterns while both exist. Use getProperty to ensure proper values.
+  private static final String STREAMS_PREFIX = "streams.";
+
+  public static final String STREAM_PREFIX = "systems.%s.streams.%s.";
+  public static final String STREAM_ID_PREFIX = STREAMS_PREFIX + "%s.";
+  public static final String SYSTEM_FOR_STREAM_ID = STREAM_ID_PREFIX + SYSTEM;
+  public static final String PHYSICAL_NAME_FOR_STREAM_ID = STREAM_ID_PREFIX + PHYSICAL_NAME;
+  public static final String IS_INTERMEDIATE_FOR_STREAM_ID = STREAM_ID_PREFIX + IS_INTERMEDIATE;
+  public static final String DELETE_COMMITTED_MESSAGES_FOR_STREAM_ID = STREAM_ID_PREFIX + DELETE_COMMITTED_MESSAGES;
+  public static final String IS_BOUNDED_FOR_STREAM_ID = STREAM_ID_PREFIX + IS_BOUNDED;
+  public static final String PRIORITY_FOR_STREAM_ID = STREAM_ID_PREFIX + PRIORITY;
+  public static final String CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID = STREAM_ID_PREFIX + CONSUMER_OFFSET_DEFAULT;
+  public static final String BOOTSTRAP_FOR_STREAM_ID = STREAM_ID_PREFIX + BOOTSTRAP;
+  public static final String BROADCAST_FOR_STREAM_ID = STREAM_ID_PREFIX + BROADCAST;
+
+  /**
+   * Helper for accessing configs related to stream properties.
 
 Review comment:
   This first line in the javadoc block might be slightly confusing then. Maybe just replace with "Implementation notes" (or something like that).
   Also, can you replace the `/**` with `/*`? With the `/**`, this javadoc is associated with the method below (i.e. `nonEmptyOption`), which would be confusing.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services