Retrieve a cached PDF image¶
PdfServiceProxy.GetImage wraps the PDFService WCF client (PDFServiceClient) to request a cached image by sequence number, asking the remote service to render and cache it immediately, and waiting through a bounded retry loop if it is not yet ready.
| Field | Value |
|---|---|
| Operation ID | OP-WP-05 |
| Trigger | A caller request; no in-repository code constructs this wrapper |
| Inputs | long imageSeqNum, int maxWaitTimeInSeconds = 10 |
| Outputs | Image bytes |
| Primary components | PdfServiceProxy.GetImage |
| Entry point | Services/SAIF.Services.Web.Proxies/PDFServiceProxy.cs |
Steps¶
- Construct
PdfServiceProxy(serviceUrl, database): guard both arguments (WP-BR-001), then build aBasicHttpBindingwithint.MaxValuequotas;databaseis stored as the data environment. GetImage(imageSeqNum, maxWaitTimeInSeconds): build aPDFCacheArgs(WP-BR-011):ImageSeqNum = imageSeqNumDataEnvironment = databaseCachePriority = 10000("retrieve, process and cache immediately")DataUser = "IMG"(a pool code, not a schema)WaitCacheEnabled = trueWaitCacheRetryAttempts = maxWaitTimeInSeconds(default 10)WaitCacheRetryInterval = 1000ms- Call wire
LoadCache(args)and returnresult.Fileas bytes. - On failure: a null
resultreturned by the wire call throwsNullReferenceException.
Process flow¶
The following diagram visualizes the cache-and-retry request.
flowchart TD
Start([GetImage invoked]) --> Build["Build PDFCacheArgs<br>(priority 10000, retry n times)"]
Build --> Call["Call wire LoadCache(args)"]
Call --> Check{result null?}
Check -->|Yes| Fail([NullReferenceException])
Check -->|No| Ret([Return result.File as bytes])
Failure and edge-case behavior¶
- A null/empty
serviceUrlordatabaseat construction throws an argument exception before any wire client is created. - A null
resultfromLoadCachethrowsNullReferenceException; there is no null guard on the wire response. - The wait/retry behavior is delegated entirely to the remote PDF service via
PDFCacheArgs; this wrapper implements no client-side retry loop of its own.
Related documentation¶
Sources¶
Services/SAIF.Services.Web.Proxies/PDFServiceProxy.cs