public void TestJoinPropsNames()
        {
            var props = StreamJoinProps.As("name1", "store1");

            Assert.IsNotNull(props);
            Assert.AreEqual("store1", props.StoreName);
            Assert.AreEqual("name1", props.Name);
        }
        public void TestJoinPropsNames2()
        {
            var props = StreamJoinProps.As <string, string, string>("name1", "store1");

            Assert.IsNotNull(props);
            Assert.AreEqual("store1", props.StoreName);
            Assert.AreEqual("name1", props.Name);
            Assert.IsNull(props.KeySerdes);
            Assert.IsNull(props.LeftValueSerdes);
            Assert.IsNull(props.RightValueSerdes);
        }
Exemplo n.º 3
0
        public void RepartitionTestJoinTopology()
        {
            var config = new StreamConfig <StringSerDes, StringSerDes>
            {
                ApplicationId = "test-repartition-processor"
            };

            var supplier = new MockKafkaSupplier(10);

            StreamBuilder builder = new StreamBuilder();

            IKStream <string, string> stream1 = builder
                                                .Stream <string, string>("topic")
                                                .Map((k, v) => KeyValuePair.Create(k.ToUpper(), v));

            IKStream <string, string> stream2 = builder.Stream <string, string>("topic2");

            stream1.Join(stream2,
                         (v1, v2) => $"{v1}-{v2}",
                         JoinWindowOptions.Of(TimeSpan.FromMinutes(1)),
                         StreamJoinProps.As <string, string, string>("join-store"))
            .To("output");

            Topology t = builder.Build();

            using (var driver = new TopologyTestDriver(t.Builder, config, TopologyTestDriver.Mode.ASYNC_CLUSTER_IN_MEMORY, supplier))
            {
                var inputTopic  = driver.CreateInputTopic <string, string>("topic");
                var inputTopic2 = driver.CreateInputTopic <string, string>("topic2");
                var outputTopic = driver.CreateOuputTopic <string, string>("output");
                inputTopic.PipeInput("test", "coucou");
                inputTopic2.PipeInput("TEST", "sylvain");
                inputTopic2.PipeInput("TEST2", "antoine");
                inputTopic.PipeInput("test2", "test");
                var records = IntegrationTestUtils
                              .WaitUntilMinKeyValueRecordsReceived(outputTopic, 2)
                              .ToUpdateDictionary(r => r.Message.Key, r => r.Message.Value);
                Assert.IsNotNull(records);
                Assert.AreEqual(2, records.Count);
                Assert.AreEqual("coucou-sylvain", records["TEST"]);
                Assert.AreEqual("test-antoine", records["TEST2"]);
            }
        }