Written by Vaughn Vernon
Solution Pattern
Business Document Publisher
Aggregates multi-channel data and content templates as input to the generation of a document that is suitable to serve as an offical statement of record.

Background
Organizations have production, reporting, financial, and other data, as well as structured content that are used as input to create business documents. The business requires an automated process to deal with the volume. Quality must be high since the documents officially represent the company and its products and services. The page layout must be precise since some sections of the document have specific visual constraints and boundaries. Open standards and open viewing tools are required for truly global consumption.
Value and Benefits
The volume of documents produced by the business is too great to perform the process manually. Driving an industry-leading word processor as an automated document engine is a poor option. Such an engine is slow, imprecise, and fragile. It lacks scalability, and must be hosted on the operating system that the word processor was designed for.
A publishing process is needed that can consistently gather data, manipulate it, and put it into a highly readable and printable format. The process needs to be able to generate a high volume of documents with repeatable precision. It must be fault tolerant, scale as business needs grow, and run on whatever enterprise platform and operating system that best supports the organization’s environment. The published documents must be consumable using prolific, open tools.
When an organization is required to produce hundreds, thousands, tens of thousands, or more documents in a day, and can meet that level of service with the desired precision and consistency, there will be no complaints about document production. When the consumers of such documents find them highly readable and printable, they will be pleased with at least this part of their customer experience.
Examples of business documents include the following, many of which I know first hand:
-
Billing and Premium Statements
-
Contracts
-
Forms
-
Instruction and Procedure Manuals
-
Insurance Policies and Claims
-
Invoices
-
Product Catalogs
-
Quotation and Pricing Statements
-
Student Guides
The list of possible applications literally goes on and on. Note also that there is no need for the overall pattern to be limited to generating highly chiseled documents. The four-step process highlighted next, in combination with Styled Page (page #) may be effectively used for Web publishing.
Putting It to Work
There are four primary steps that are performed in any automated publishing process:
-
Aggregate all the data that will server as input to the document
-
Assemble the gathered data into a structured data stream that can serve as input to the page layout engine
-
Pour the input data into a page layout and content formatting engine that produces the desired print-ready document
-
Publish the document by distributing the finished product as necessary
The Business Document Publisher executes those steps. Each is a separate behavioral concern, and, therefore, can be examined individually as the four key strategies of this pattern.
Data Aggregation
Data aggregation is the process of gathering information from multiple, disparate sources into a single object model that can be traversed in a convenient manner. Data gathering requires some sophistication because of the potential for reading data from multiple, disparate channels. In the age of enterprise information systems it is not difficult to imagine an environment in which your data channels consist of a production database, a legacy database, an ERP application, a partner catalog, and a content management system.
It is also not difficult to imagine a much simpler “silo” application. If your domain will consistently read from a single data channel, such as a production or reporting database, then there is no reason to tackle the complexities of a multi-channel publisher. I will first present the single-channel data reader. With that behind us the multi-channel aggregator will be much easier to understand.
It is fairly common to publish documents out of a single-channel input mechanism. If you are generating a policy document or another kind of contract, the data that will make up the document content is probably in the production database of the system that is publishing the document. It may be a new system that was architected, designed, and developed to solve a single, well-defined problem. This might correspond to the Basic B2C or cookie-cutter E-Commerce B2C systems that were described in Chapter 2. The documents being produced get their data from the application’s native data source.
There are several patterns used to access the domain objects from a standard data source. One or more of the following may be what your enterprise application already uses. There is no reason for us to search for another access pattern since our document publisher should use the one that is part of the established system architectural blueprints. So we will just use what we use elsewhere in the same system:
-
Business Object
-
Composite Entity
-
Data Access Objects
-
Domain Model
-
Domain Store
-
Service Data Objects
-
Table Data Gateway
-
Table Module
Like the Domain Object Model Adapter, this one is also based on the standard Adapter pattern [GoF].