I am trying to implement a DICOM proxy server using WCF. That it is DICOM isn't really important, except that it forces me to use a particular process for getting image files: Under DICOM, you set up a listener on a well known IPAddress/Port which is registered with an ID (AETITLE) on a server. You then send a query to that server, and at some time in the future (or maybe never) the server sends the image file directly to your listener.
My listener will be a method on the proxy, that will receive the DICOM file.
The proxy will work using WCF, receiving requests from the desktop client. In this case, the desktop client will send a request to the proxy using WCF, for a particular study UID (a GUID for the file from the actual server), I am then happy to have that thread block for a reply from the proxy until the file arrives at the listener, I might also, eventually, use callbacks - but the same problem applies.
So:
Client Proxy DICOM Server
|RegisterListener--------->|
|
|Request(StudyID)------->|
| |Request StudyID---------->|
| |
| |<--------------Send(DICOM)|
|<----------Return(DICOM)|
Is there a pattern or example I can use to implement this? I assume I need to register a pointer (delegate??) to the client making the request, so the proxy knows which client to return the image to when the listener gets the file from the DICOM server? Can I make a dictionary of (StudyUID, List(Of Delegate)) or some similar structure to get this to work (will be List(Of Delegate) as their could be multiple clients requesting the same study)?
Or is it better to just have the proxy thread watch a shared dictionary and wait until that entry is populated with the file? ie: have a shared dictionary of (StudyID, DICOMFile) that is monitored by the clients requesting thread and populated by the proxy listener? This would preclude me from using Async Callbacks though.
Any suggestions welcome. Hopefully this isn't too vague...