question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

External call inside topology

See original GitHub issue

Description

If you have already built a Kafka Streams application and you had to call an external service or database in the middle of one of your topologies, you’ve probably faced some issues if that call takes too long which can drive your stream processing application in serious troubles and most likely your overall system in some kind of snowball effect. If not (or not yet 😉), your application is prone such issues and you should be aware about that.

It’s true with JAVA implementation but also in another way with librdkafka based clients.

max.poll.interval.ms = 300000

The aims of this purpose is to allow execute external async call inside your Streamiz topology.

280950129_725742468568986_2513486809243885186_n

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
LGouelleccommented, Jun 23, 2022

@RogerSep,

Because after some reflexion internally, I think it makes more sense to have these ones compared with just an ExternalCallAsync().

As well, developers could map/flatMap key/value or just value with an asynchronous processing (calling a database, HTTP Api, or so on …).

It would be great ! For documentation, I had thought two things :

  • Update the stateless page for adding MapAsync(), FlatMapAsync(), MapValuesAsync(), FlatMapValuesAsync() and ForeachAsync(). A brief describe for each new DSL method like the other examples.
  • Add a dedicated webpage in two parts : How Streamiz do to make asynchronous processing ? (which pattern use, …) and in second part more a tutoriel with a schema to illustrate the use case, a docker-compose stack, a topology implementation and some screenshots on “How make an asynchronous processing with Streamiz” and I had thought about a use case like : Stream topic A - MapValuesAsync(…) with a mongodb collection - Join an another stream B - Publish in topic C.

And later I will add the page regarding the threading model.

0reactions
LGouelleccommented, Aug 2, 2022

Example use case :

            StreamBuilder builder = new StreamBuilder();

            var client = new MongoClient(
                "mongodb://admin:admin@localhost:27017"
            );
            var database = client.GetDatabase("streamiz");

            builder
                .Stream<string, string>("person")
                .MapValuesAsync(async (record, _) => {
                    var persons = await database
                        .GetCollection<Person>("adress")
                        .FindAsync((p) => p.name.Equals(record.Key))
                        .Result.ToListAsync();
                    return persons.FirstOrDefault()?.address.city;
                },
                    RetryPolicy
                        .NewBuilder()
                        .NumberOfRetry(10)
                        .RetryBackOffMs(100)
                        .RetriableException<Exception>()
                        .RetryBehavior(EndRetryBehavior.BUFFERED)
                        .Build())
                .To("person-city");
Read more comments on GitHub >

github_iconTop Results From Across the Web

External & Internal devices: Network Topology
External and Internal Devices: Network Topology. The 3CX Phone System frequently communicates across LANs and establishes calls between devices ...
Read more >
Plan for Local Media Optimization for Direct Routing
In a virtual network topology, downstream SBCs are communicating through internal IPs and are not directly visible to Phone System.
Read more >
Hiding the Internal Topology Information Embedded Within ...
Restrictions for Hiding the Internal Topology Information​​ The user needs to be in the same network as the network in which the call...
Read more >
VoIP Domain - MGCP Call Agent
In this image, the IP phones use a Call Agent on the external side of the gateway. This topology enables the a Call...
Read more >
Pod Topology Spread Constraints
You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found