Hi, I am trying to implement an async function that looks up a value in a cache or, if the value doesn't exist in the cache, queries a web service, but I'm having trouble creating the cache. I've tried to create a RichAsyncFunction and add a map state as cache, but I'm getting: State is not supported in rich async functions. What is the best practice for doing this? I guess I could have a previous step with state and send the responses from the rich function back as an iteration, but I would guess that's the wrong approach... Thanks, William |
Hi William, Does the cache need to be fault tolerant? If not you could use a regular in-memory map as cache (+some LRU cleaning). Or do you expect the cache to group too large for the memory? Best, Fabian Am Mo., 4. Feb. 2019 um 18:00 Uhr schrieb William Saar <[hidden email]>:
|
Hi William
We have created a solution that do it. Please take a look at my presentation from Flink forward. Hopefully you can get inspired.
Med venlig hilsen / Best regards Lasse Nedergaard
|
Thanks! Looks like iterations is indeed the way to go for now then...
|
Hi William
No iterations isn’t the solution as you can (will) end up in a deadlock. We concluded that storing the results from external lookup in Kafka and use these data as input to the cache was the only way
Med venlig hilsen / Best regards Lasse Nedergaard
|
Ah, thanks, missed it when I only looked at the slides. Yes, have heard deadlocks are a problem with iterations but hoped it had been fixed. Pity, had been hoping to replace an external service with the Flink job, but will keep the service around for the caching,
|
Free forum by Nabble | Edit this page |