I'm working on a Perl project that has a client sending requests to a server and the ssl connection used for this is kept open until the response is complete. What I want to do is add a layer between that queues the requests and possibly combines them when is makes sense to do so. So it will listen for client requests and then bundle them to send to the server. When the server responds, the response will be broken up to send back to the requesting clients.
I'm not a Perl expert but I've been doing software for a while. Here is what I have tried to do on the server side. I created a thread for listening for incoming request, one for listening to responses from the server and one for working the Thread Queue I created to hold the requests.
I'm not sure this is the correct architecture in the first place, but my problem seems to be that I can't put the connection into the queue so it can be used later when this layer needs to send a response to the clients.
Is there a way to do this? Or should I push for a redesign of the way communications are done between client and server? I'm starting to think a redesign would be best, but this would require a listener on the client side for responses and matching them up with previous requests.