Exemplo n.º 1
0
 public void RepartitionAs()
 {
     SetupTest((builder) =>
     {
         builder
         .Stream <string, string>("topic")
         .Repartition(Repartitioned <string, string> .As("repartition-processor"))
         .To("output");
     });
 }
Exemplo n.º 2
0
 public void RepartitionCreateWithSerDes()
 {
     SetupTest((builder) =>
     {
         builder
         .Stream <string, string>("topic")
         .Repartition(Repartitioned <string, string> .Create <StringSerDes, StringSerDes>())
         .To("output");
     });
 }
Exemplo n.º 3
0
 public void RepartitionWithExplicitSerDes()
 {
     SetupTest((builder) =>
     {
         builder
         .Stream <string, string>("topic")
         .Repartition(Repartitioned <string, string> .With(new StringSerDes(), new StringSerDes()))
         .To("output");
     });
 }
Exemplo n.º 4
0
        public void RepartitionWithPartitioner()
        {
            var records = SetupTest((builder) =>
            {
                builder
                .Stream <string, string>("topic")
                .Repartition(Repartitioned <string, string> .Empty().WithStreamPartitioner((t, k, v) => 0))
                .To("output");
            }, TopologyTestDriver.Mode.ASYNC_CLUSTER_IN_MEMORY, 10);

            Assert.AreEqual(0, records.ToList()[0].Partition.Value);
            Assert.AreEqual(0, records.ToList()[1].Partition.Value);
            Assert.AreEqual(0, records.ToList()[2].Partition.Value);
        }
Exemplo n.º 5
0
        public void RepartitionWithPartitionNumber()
        {
            var records = SetupTest((builder) =>
            {
                builder
                .Stream <string, string>("topic")
                .Repartition(Repartitioned <string, string> .Empty().WithNumberOfPartitions(20))
                .To("output");
            }, TopologyTestDriver.Mode.ASYNC_CLUSTER_IN_MEMORY);

            // topic - 1 partitions
            // repartitionTopic - 20 partitions
            // output - 1 partitions

            Assert.AreEqual(0, records.ToList()[0].Partition.Value);
            Assert.AreEqual(0, records.ToList()[1].Partition.Value);
            Assert.AreEqual(0, records.ToList()[2].Partition.Value);
        }