We have a currently operating WCF Service and COBOL VM communicating to provide access to data from Vision files. The process works, but we have to limit the WCF Service to [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)]
. It works, but at times appears slow to users because they are being queued and some of the requests are longer than a couple of seconds at times.
The COBOL VM is a singleton, so I don't believe I can isolate my COBOL program from multiple WCF Service requests without them stepping on each other. The COBOL program has no way of knowing what call is for which client, it just returns/manipulates data.
My thought is to create a program in COBOL that will manage my requests for me, but I'm not sure how to get that information back to the WCF Service so that it responds to the correct client request.
My thought is to pass some ID of the WCF client request, like a guid. The COBOL program will store the WCF guid and call another program that gets the data for me in COBOL using the guid. The COBOL program then returns the data with the ID, but I need some method of making sure the right requested data is routed to the right WCF client request.
THE PROCESS:
WCF Client 1->WCF Service (creates WCF_id1)->COBOL program 1(WCF_id1)->COBOL getData(WCF_id1).
WCF Client 2->WCF Service (creates WCF_id2)->COBOL program 1(WCF_id2)->COBOL getData(WCF_id2).
WCF Service stores both Wcf_id1 and Wcf_id2 somehow associating them with the WCF Client that requested them.
COBOL program 1 stores both Wcf_id1 and Wcf_id2 and makes the request to COBOL getData individually passing in the ids.
Both Client 1 and Client 2 are waiting for a response.
COBOL getData(WCF_id2)->COBOL program 1(WCF_id2)->WCF Service(WCF_id2)
From here, how can I make sure that WCF Client 2 gets this data and not WCF Client 1?
I want to look at the returned data from the COBOL program and then route it to the client that requested it. Is this possible in WCF?
I've been looking at WCF Callbacks thinking that I might be able to use a callback to query the WCF_id and then return the data to the correct WCF Client.
Am I on the right track? Should I be looking at some other WCF capability?