Generic value instead of string
See original GitHub issueHi,
How can I use your library using generic models for value instead of string type. I didn’t find any example in documentation. My code works fine with string generic but it fails when I try to use custom model. Code snippet:
var config = new StreamConfig<StringSerDes, JsonSerDes>
{
ApplicationId = "test-app",
BootstrapServers = "localhost:9093",
AutoOffsetReset = AutoOffsetReset.Earliest,
};
var builder = new StreamBuilder();
var personStream = builder.Stream<string, Person>("persons", new StringSerDes(), new JsonSerDes<Person>());
var locationStream = builder.Stream<string, Location>("locations", new StringSerDes(), new JsonSerDes<Location>());
var jobStream = builder.Stream<string, Job>("jobs", new StringSerDes(), new JsonSerDes<Job>());
personStream
.SelectKey((k, v) => v.LocationId)
.Join(locationStream.ToTable(),
(v1, v2) => new PersonLocation
{
Person = v1,
Location = v2
})
.SelectKey((k, v) => v.Person.JobId)
.Join(jobStream.ToTable(), (v1, v2) => new PersonJobLocation{
Person = v1.Person,
Location = v1.Location,
Job = v2
})
.To<StringSerDes, JsonSerDes<PersonJobLocation>>("person-job-location");
var topology = builder.Build();
var stream = new KafkaStream(topology, config);
Console.CancelKeyPress += (_, _) => {
stream.Dispose();
};
await stream.StartAsync();
Best regards
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How can I constrain generic parameter to be assignable ...
I intend this generic parameter to be either a sum types of different constant strings, like "alpha"|"beta" , or an enum with string...
Read more >How to implement a generic `ValueOf<T>` helper type in ...
The first challenge we're up against is working with an object instead of a type . So before we can do anything, we...
Read more >How To Use Generics in TypeScript
In this code, you are creating a new generic type, which is a conditional type called GetReturnType . This generic type accepts a...
Read more >Documentation - Generics
Here we explicitly set Type to be string as one of the arguments to the function call, denoted using the <> around the...
Read more >Complete Guide to Using Typescript Generics
In this tutorial, you'll learn all you need to know about integrating TypeScript generics into your projects and using it to your advantage....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Tracking issue https://github.com/LGouellec/kafka-streams-dotnet/issues/158 for the fix
@PabloDeCortes, Thanks, I will have a look.