Distribute a document¶
Distributes a document either by queuing a composite print request through MSMQ or by calling the xPression service directly, depending on the Asynchronous setting, covering print, imaging, e-mail, fax, and deferred output channels in a single request.
| Field | Value |
|---|---|
| Operation ID | OP-04 |
| Trigger | clsPrint.distributeDocument invoked |
| Inputs | Package, XML, plus instance state Printer, PlexMode, Copies, ScaleMode, Format, OutputProfile, ImportInfo, EmailInfo, FaxInfo, DeferredInfo, IDMPath (derived from environment configuration) |
| Outputs | True; side effect is an MSMQ message send or a direct SOAP call |
| Primary components | clsPrint.distributeDocument (public), private distributeDocument(), CompositeRequestClass, StartMQTransaction/EndMQTransaction, m_Xpresso.distributeDocument |
| Entry point | SAIF.Services.Printing/clsPrint.vb |
Steps¶
- Trims and assigns
inPackageto thePackageproperty. The package name is normalized by stripping a trailing.pkgextension via thePackagesetter (BR-PRT-001). - Assigns
inXMLto theXMLproperty. - Delegates to the private parameterless
distributeDocument(), which branches on theAsynchronousproperty (BR-PRT-003). - Asynchronous branch:
- Lazily creates
m_Queuefromm_MessagePath(a config-driven MSMQ path) if it is not already open. - Builds a
CompositeRequestClasssnapshottingPackage,XML,Printer,PlexMode,Copies,ScaleMode,Format,OutputProfile,ImportInfo(the raw object, not its serialized string form),EmailInfo,FaxInfo,IDMPath, andDeferredInfo.- The
CompositeRequestClass.Trayfield is left at its default value in this branch — it is never assigned, unlike the synchronous branch's fixedPaperTray.Tray2.*
- The
- Wraps the snapshot in a
MessageusingMessaging.BinaryMessageFormatter. -
If the caller already started a transaction, sends the message on that existing transaction; otherwise starts a new transaction, sends the message, and commits it for just this one message (BR-PRT-004).
Origin: The transaction start/commit mechanic used here is the same logic documented in MSMQ transaction management (
StartMQTransaction/EndMQTransaction); see that page for the full behavior rather than a re-description here. - On failure: rolls back the transaction (EndMQTransaction(False)) and rethrows the exception (BR-PRT-005). 5. Synchronous branch: callsm_Xpresso.distributeDocument(m_Package, m_XML, m_Printer, m_Plexmode, m_Copies, m_Scalemode, m_OutputProfile, ImportInfoString, m_EmailInfo, m_FaxInfo, IDMPath, PaperTray.Tray2, m_DeferredInfo, m_Application)directly against the xPression SOAP service, hard-codingPaperTray.Tray2regardless of any caller preference (BR-PRT-006). - This branch passesImportInfoString(the serialized string form ofImportInfo) to the SOAP call, whereas the asynchronous branch'sCompositeRequestClasssnapshot instead carries the rawImportInfoobject — a structural asymmetry between the two branches.* 6. ReturnsTrueunconditionally, both on the synchronous path and after a successful asynchronous send (BR-PRT-013).
Process flow¶
flowchart TD
Start(["distributeDocument invoked"]) --> Norm["Normalize package name"]
Norm --> Decision{"Asynchronous?"}
Decision -->|Yes| Tx["Start/reuse MSMQ transaction"]
Tx --> Build["Build CompositeRequestClass<br>(Tray left unset)"]
Build --> Send["Send via BinaryMessageFormatter"]
Send --> Commit["Commit transaction"]
Commit --> EndYes(["Return True"])
Tx -->|Exception| Rollback["Rollback and rethrow"]
Decision -->|No| Direct["Direct xPression distributeDocument<br>Tray2 fixed"]
Direct --> EndNo(["Return True"])
Failure and edge-case behavior¶
- Asynchronous failures roll back the MSMQ transaction and rethrow — no partially-sent message survives (BR-PRT-005).
- The synchronous branch has no equivalent rollback mechanism, since no transaction exists on that path.
- The synchronous branch's
Truereturn happens even though the underlying SOAP call could itself throw before returning — the same BR-PRT-013 caveat described in Print rendered bytes applies here. - The
CompositeRequestClass.Trayfield is never set in the asynchronous branch, so a queued message's tray value is whatever the defaultPaperTrayenum value is, unlike the synchronous branch's explicitTray2— a discrepancy between the two distribution paths that is not currently reconciled by a business rule.*
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Operations and processes
- Business rules
- Configuration
- API reference
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Services.Printing/clsPrint.vb