internal StreamJoinProps(WindowBytesStoreSupplier thisStoreSupplier, WindowBytesStoreSupplier otherStoreSupplier, string name, string storeName) { this.thisStoreSupplier = thisStoreSupplier; this.otherStoreSupplier = otherStoreSupplier; this.name = name; this.storeName = storeName; }
private void AssertUniqueStoreNames(WindowBytesStoreSupplier supplier, WindowBytesStoreSupplier otherSupplier) { if (supplier != null && otherSupplier != null && supplier.Name.Equals(otherSupplier.Name)) { throw new StreamsException("Both StoreSuppliers have the same name. StoreSuppliers must provide unique names"); } }
/// <summary> /// Creates a StreamJoined instance with the provided store suppliers. The store suppliers must implement /// the <see cref="WindowBytesStoreSupplier"/> interface. The store suppliers must provide unique names or a /// <see cref="Streamiz.Kafka.Net.Errors.StreamsException"/> is thrown. /// </summary> /// <param name="storeSupplier">this store supplier</param> /// <param name="otherStoreSupplier">other store supplier</param> /// <returns>Return <see cref="StreamJoinProps"/> instance</returns> public static StreamJoinProps With(WindowBytesStoreSupplier storeSupplier, WindowBytesStoreSupplier otherStoreSupplier) { return(new StreamJoinProps( storeSupplier, otherStoreSupplier, null, null )); }
private void AssertWindowSettings(WindowBytesStoreSupplier supplier, JoinWindowOptions joinWindows) { bool allMatch = supplier.Retention == (joinWindows.Size + joinWindows.GracePeriodMs) && supplier.WindowSize == joinWindows.Size; if (!allMatch) { throw new StreamsException($"Window settings mismatch. WindowBytesStoreSupplier settings {supplier} supplier must match JoinWindows settings {joinWindows}"); } }
/// <summary> /// Creates a StreamJoined instance with the provided store suppliers. The store suppliers must implement /// the <see cref="WindowBytesStoreSupplier"/> interface. The store suppliers must provide unique names or a /// <see cref="Streamiz.Kafka.Net.Errors.StreamsException"/> is thrown. /// </summary> /// <typeparam name="K">the key type</typeparam> /// <typeparam name="V1">the value type</typeparam> /// <typeparam name="V2">the other value type</typeparam> /// <param name="storeSupplier">this store supplier</param> /// <param name="otherStoreSupplier">other store supplier</param> /// <returns>Return <see cref="StreamJoinProps{K, V1, V2}"/> instance</returns> public static StreamJoinProps <K, V1, V2> With <K, V1, V2>(WindowBytesStoreSupplier storeSupplier, WindowBytesStoreSupplier otherStoreSupplier) { return(new StreamJoinProps <K, V1, V2>( null, null, null, storeSupplier, otherStoreSupplier, null, null )); }
public StoreBuilder <TimestampedWindowStore <K, V> > Materialize() { WindowBytesStoreSupplier supplier = (WindowBytesStoreSupplier)materializedInternal.StoreSupplier; if (supplier == null) { if (windowsOptions.Size + windowsOptions.GracePeriodMs > materializedInternal.Retention.TotalMilliseconds) { throw new ArgumentException($"The retention period of the window store { materializedInternal.StoreName } must be no smaller than its window size plus the grace period. Got size=[{windowsOptions.Size}], grace=[{windowsOptions.GracePeriodMs}], retention=[{materializedInternal.Retention.TotalMilliseconds}]."); } // TODO : RocksDB supplier = new InMemoryWindowStoreSupplier( materializedInternal.StoreName, materializedInternal.Retention, windowsOptions.Size); } else { supplier.WindowSize = !supplier.WindowSize.HasValue ? windowsOptions.Size : supplier.WindowSize.Value; } var builder = Stores.TimestampedWindowStoreBuilder(supplier, materializedInternal.KeySerdes, materializedInternal.ValueSerdes); if (materializedInternal.LoggingEnabled) { builder.WithLoggingEnabled(materializedInternal.TopicConfig); } else { builder.WithLoggingDisabled(); } if (materializedInternal.CachingEnabled) { builder.WithCachingEnabled(); } return(builder); }
/// <summary> /// Materialize a <see cref="WindowStore{K, V}"/> using the provided <see cref="WindowBytesStoreSupplier"/> /// Important: Custom subclasses are allowed here, but they should respect the retention contract: /// Window stores are required to retain windows at least as long as (window size + window grace period). /// </summary> /// <typeparam name="KS">New serializer for <typeparamref name="K"/> type</typeparam> /// <typeparam name="VS">New serializer for <typeparamref name="V"/> type</typeparam> /// <param name="supplier">the <see cref="WindowBytesStoreSupplier"/> used to materialize the store</param> /// <returns>a new <see cref="Materialized{K, V, S}"/> instance with the given supplier</returns> public static Materialized <K, V, WindowStore <Bytes, byte[]> > Create <KS, VS>(WindowBytesStoreSupplier supplier) where KS : ISerDes <K>, new() where VS : ISerDes <V>, new() { var m = new Materialized <K, V, WindowStore <Bytes, byte[]> >(supplier) { KeySerdes = new KS(), ValueSerdes = new VS() }; return(m); }
/// <summary> /// Materialize a <see cref="WindowStore{K, V}"/> using the provided <see cref="WindowBytesStoreSupplier"/> /// Important: Custom subclasses are allowed here, but they should respect the retention contract: /// Window stores are required to retain windows at least as long as (window size + window grace period). /// </summary> /// <param name="supplier">the <see cref="WindowBytesStoreSupplier"/> used to materialize the store</param> /// <returns>a new <see cref="Materialized{K, V, S}"/> instance with the given supplier</returns> public static Materialized <K, V, WindowStore <Bytes, byte[]> > Create(WindowBytesStoreSupplier supplier) { var m = new Materialized <K, V, WindowStore <Bytes, byte[]> >(supplier); return(m); }
public static StoreBuilder <TimestampedWindowStore <K, V> > TimestampedWindowStoreBuilder <K, V>(WindowBytesStoreSupplier supplier, ISerDes <K> keySerde, ISerDes <V> valueSerde) { return(new TimestampedWindowStoreBuilder <K, V>(supplier, keySerde, valueSerde)); }
public static StoreBuilder <WindowStore <K, V> > WindowStoreBuilder <K, V>(WindowBytesStoreSupplier supplier, ISerDes <K> keySerdes, ISerDes <V> valueSerdes) { return(new WindowStoreBuilder <K, V>(supplier, keySerdes, valueSerdes)); }
public TimestampedWindowStoreBuilder(WindowBytesStoreSupplier supplier, ISerDes <K> keySerde, ISerDes <V> valueSerde) : base(supplier.Name, keySerde, valueSerde == null ? null : new ValueAndTimestampSerDes <V>(valueSerde)) { this.supplier = supplier; }
public WindowStoreBuilder(WindowBytesStoreSupplier supplier, ISerDes <K> keySerde, ISerDes <V> valueSerde) : base(supplier.Name, keySerde, valueSerde) { this.supplier = supplier; }