2929 */
3030public class StreamsRegistry implements AutoCloseable {
3131
32+ /**
33+ * Specifies the target Factor House product this StreamsRegistry should produce to.
34+ */
35+ public enum TargetProduct {
36+ KPOW ,
37+ FACTOR_PLATFORM ;
38+
39+ public String getInternalTopic () {
40+ return switch (this ) {
41+ case KPOW -> "__oprtr_snapshot_state" ;
42+ case FACTOR_PLATFORM -> "fh_snapshots" ;
43+ };
44+ }
45+ }
46+
3247 /**
3348 * Represents an agent for a registered Kafka Streams application.
3449 * Provides the unique identifier of the registered application.
@@ -129,6 +144,28 @@ public static Properties filterProperties(Properties props) {
129144 * @throws IllegalArgumentException if the provided {@code props} are invalid or incomplete.
130145 */
131146 public StreamsRegistry (Properties props , MetricFilter metricsFilter ) {
147+ this (props , metricsFilter , TargetProduct .KPOW );
148+ }
149+
150+ /**
151+ * Constructs a {@code StreamsRegistry} instance using the specified Kafka properties and metrics filter.
152+ *
153+ * <p>This constructor initializes the registry, allowing Kafka Streams applications to be registered
154+ * for monitoring through Kpow's user interface and API. The provided {@link Properties} object is
155+ * used to configure the underlying Kafka producer, and the {@link MetricFilter} determines which metrics
156+ * are collected and sent to Kpow's internal Kafka topic.</p>
157+ *
158+ * <p><b>Important:</b> The Kafka producer properties provided in {@code props} must match the connection
159+ * details of Kpow's primary cluster, where Kpow's internal topic resides.</p>
160+ *
161+ * @param props the {@link Properties} object containing Kafka configuration.
162+ * Must include essential properties like {@code bootstrap.servers}.
163+ * @param metricsFilter the {@link MetricFilter} to customize which metrics are reported.
164+ * Use {@link MetricFilter#defaultMetricFilter()} for default behavior.
165+ * @param metricsFilter the {@link TargetProduct} specifies which Factor House product should receive the agent's metrics.
166+ * @throws IllegalArgumentException if the provided {@code props} are invalid or incomplete.
167+ */
168+ public StreamsRegistry (Properties props , MetricFilter metricsFilter , TargetProduct targetProduct ) {
132169 IFn require = Clojure .var ("clojure.core" , "require" );
133170 require .invoke (Clojure .read ("io.factorhouse.kpow.agent" ));
134171 IFn agentFn = Clojure .var ("io.factorhouse.kpow.agent" , "init-registry" );
@@ -138,7 +175,7 @@ public StreamsRegistry(Properties props, MetricFilter metricsFilter) {
138175 Serializer valSerializer = (Serializer ) serdesFn .invoke ();
139176 Properties producerProps = filterProperties (props );
140177 KafkaProducer producer = new KafkaProducer <>(producerProps , keySerializer , valSerializer );
141- agent = agentFn .invoke (producer , metricsFilter );
178+ agent = agentFn .invoke (producer , metricsFilter , targetProduct . getInternalTopic () );
142179 }
143180
144181 /**
0 commit comments