Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2203

Redis (pub/sub) Subscribe to a Channel Using GET Request

$
0
0

I have two end points,

  1. first -> this is a post end point which receives requests and then puts the response in cache
  2. second -> reads the redis cache for a particular key

now a case occurs when the first request is not complete and the request comes to second end point that expects the result from the currently running process in the first end point.

Now I want some sort of mechanism so that the request in the second end-point can wait for some time so that the request in the first end point finishes and thus request in the second end point can read the output of the first end point from the redis cache.

So I thought of creating a channel so that if the second end point can subscribe to it, if it does not find any data in the cacheand once the first end point gets the response it can fill the cache and notify the channel that I have the response and whichever subscribers need that response can get it and return them.and if the subscribers don't get data within 100ms timeout happens

but the problem is that I don't know how to subscribe to a channel over a get request and wait for 100ms or response whichever is earlier.

Can anyone please help?


Viewing all articles
Browse latest Browse all 2203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>