hi guys!
I am trying to test my topology which has two outputs.
first one is pretty simple, without any joins and it works fine.
Second one has leftJoin and the test fails.
Here is my topology example:
TOPOLOGY:
*KSTream<String, Student> studentsStream = *
getStudentsStream();
KTable<String, UniRoom> universityRoomsTable = roomsStream.
groupBy((k,v)->v.getId(), Grouped.with(Serdes.String(), avroRoomSerde)
reduce((aggValue, newValue) → newValue,
Materialized.<String, UniRoom, KeyValueStore<Bytes, byte[]>>as(“rooms-store” + System.currentTimeMillis())
.withKeySerde(Serdes.String())
.withValueSerde(avroRoomSerde));
the join itself
studentsStream.map((k,v)->v.getRoomId(), v)
.leftJoin(universityRoomsTable, mergeFunction, Joined.with(Serdes.String(), avroStudentSerde, avroRoomSerde)
. and so on…
so here is my test:
creating the input topics and pushing data into them:
var studentAvro = Student.builder.roomId(1).build();
var roomAvro = Room.builder.id(1).build();
studentsTopic.pipeInput(“1”, studentAvro);
roomsTopic.pipeInput(“1”, roomAvro);
and then into my mergeFunction which is method(Student, UniRoom) the right side of uniRoom is always null!
Why?
Whenever I start this code to DEV I have matches by the room id and i perform the merge function successfully in the join. Why with this TestTopologyDriver is failing?