Code block completing before method inside MapValuesAsync finishes #344
-
DescriptionStreamiz version: 1.4.2 I have a Stream where I want to take in a string and call a method on MapValuesAsync to determine the correct version type then either upscale it or return the correct event version. I then want to map the type of the string value to become a eventEnvelope Further in the code block I have a join on this stream which I want to happen after mapvaluesAsync has completed. Is it possible to force the code to wait until MapValuesAsync has completed before progressing the rest of the code block? How to reproduceMethod:
CreateEvent() method in the test kicks off the event that streamCreator is listening to. ChecklistPlease provide the following information:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @RossSteele1 , I tried to reproduce without success. If you can checkout this branch and test it with your custom code (event, async event processor), would be very helpful to troubleshoot : https://github.com/LGouellec/kafka-streams-dotnet/blob/reproduce/344/test/Streamiz.Kafka.Net.Tests/Reproducer344Tests.cs But in other words, did you test your topology with a real kafka cluster ? So be careful, because in the real life with a real Kafka Cluster, your join stream-global table is dependant of the order of producing message and order of processing. If your stream input topic event is processed before your event from your global Table, the join won't happen. Why using a global table and not a KTable because it seems you have the same key. So if your topic are co-partitioned, my recommendation could be to use a KTable. |
Beta Was this translation helpful? Give feedback.
Hi @RossSteele1 ,
I made couple of changes of your code, and now the unit test is green ✅
// the issue was due because you tried to serialize the v3Envelope which is a Task<Envelope> and not the result of the task
Please checkout my branch and test another time.
If you switch the
TopologyTestDriver.Mode
toASYNC_CLUSTER_IN_MEMORY
(an async mock Kafka cluster), the unit test still green as well :But what you need to understand, if you want to join with Gl…