Integration Server 10.15 | Publish-Subscribe Developer’s Guide | Publishing Documents | Delivering a Document | How to Deliver a Document
 
How to Deliver a Document
To deliver a document, you invoke the pub.publish:deliver service. The following describes the general steps you take to create a service that delivers a document to a specific destination.
1. Create a document reference to the publishable document type that you want to deliver. You can accomplish this by:
*Declaring a document reference in the input signature of the publishing service
-OR-
*Inserting a MAP step in the publishing service and adding the document reference to Pipeline Out. You must immediately link or assign a value to the document reference. If you do not, the document reference is automatically cleared the next time the Pipeline view is refreshed.
2. Add content to the document reference. You can add content by linking fields to the document reference or by using the Set Value modifier to assign values to the fields in the document reference.
3. Assign values to fields in the envelope (_env field) of the document reference. When a service or adapter notification publishes a document, Integration Server and the messaging provider automatically assign values to fields in the document envelope. However, you can manually set some of these fields. Integration Server and the messaging provider do not overwrite fields that you set manually. For more information about assigning values to fields in the document envelope, see Setting Fields in the Document Envelope.
Note:
In the Pipeline view, you can assign values only to fields under Pipeline Out or Service In.
4. Set values for custom header fields. When publishing a document to Universal Messaging, you can add custom header fields to the document by assigning values to a _properties document variable in the publishable document type. Integration Server adds the contents of _properties as name=value pairs to the header. Subscribers of the publishable document type can register filters that indicate which documents the subscriber wants to receive based on the custom header field contents. When Universal Messaging receives the published document, it applies the filter and only routes the document to the subscriber if the filter criteria is met.
5. Invoke pub.publish:deliver to deliver the document. This service takes the document you created and publishes it.
The pub.publish:deliver service expects to find a document (IData object) named document in the pipeline. If you are building a flow service, you will need to use the Pipeline view to map the document you want to deliver to document.
In addition to the document reference you map into document, you must provide the following parameters to pub.publish:deliver.
Name
Description
documentTypeName
A String specifying the fully qualified name of the publishable document type that you want to publish. The publishable document type must exist on the Integration Server.
Note:
Instances of publishable document types that use the IS_LOCAL_CONNECTION messaging connection alias cannot be delivered.
destID
String specifying the ID for the destination to which you want to deliver the document. You can specify the ID for an individual trigger or the default client of an Integration Server as the destination. When you deliver a document to the default client of Integration Server, Integration Server routes the delivered document to any subscribers on that Integration Server.
If you specify an invalid client ID, the Integration Server delivers the document to the messaging provider, but the messaging provider never delivers the document to the intended recipient and no error is produced.
You may also provide the following optional parameters:
Name
Description
delayUntilServiceSuccess
A String specifying that Integration Server will delay publishing the document until the top-level service executes successfully. If the top-level service fails, the Integration Server will not publish the document.
Set to...
To...
true
Delay publishing until after the top-level service executes successfully.
false
Publish the document when the pub.publish:deliver service executes. This is the default.
Note:
The watt.server.control.maxPublishOnSuccess parameter controls the maximum number of documents that Integration Server can publish on success at one time. You can use this parameter to prevent the server from running out of memory when a service publishes many, large documents on success. By default, this parameter is set to 50,000 documents. Decrease the number of documents that can be published on success to help prevent an out of memory error. For more information about this parameter, see webMethods Integration Server Administrator’s Guide.