Integration Server 10.15 | Publish-Subscribe Developer’s Guide | Publishing Documents | Publishing a Document | How to Publish a Document
 
How to Publish a Document
The following describes the general steps you take to create a service that publishes a document.
1. Create a document reference to the publishable document type that you want to publish. 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 (Broker or Universal Messaging) automatically assign values to many fields in the document envelope. However, you can manually set some of these fields. Integration Server, Broker, and Universal Messaging 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:
If you assign a value to the uuid field in the document envelope, Integration Server uses that value only if the pub.publish:publish service sends a document to Universal Messaging. If the pub.publish:publish service publishes a document to Broker or locally, Integration Server overwrites the assigned uuid value with one that Integration Server generates upon publish.
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:publish to publish the document. This service takes the document you created and publishes it.
Note:Integration Server issues a ServiceException when the dispatcher is shut down during the execution of this service. Make sure to code your service to handle this situation.
The pub.publish:publish 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 publish to document.
In addition to the document reference you map into document, you must provide the following parameter to pub.publish:publish.
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 Integration Server.
You may also provide the following optional parameters:
Name
Description
local
A String indicating whether you want to publish the document locally. When you publish a document locally, Integration Server does not send the document to the messaging provider. The document remains on the publishing Integration Server. Only subscribers on the same Integration Server can receive and process the document.
The local parameter applies only when the publishable document type specified for documentTypeName uses the Broker connection alias. A publishable document type that specifies Universal Messaging as the messaging provider cannot be published locally. A publishable document type that specifies the IS_LOCAL_CONNECTION alias can be published locally only. Integration Server uses the local value only if the publishable document type uses a Broker connection alias.
Set to...
To...
true
Publish the document locally.
false
Publish the document to the configured messaging provider. This is the default.
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, Integration Server will not publish the document.
Set to...
To...
true
Delay publishing until after the top-level service executes successfully.
Note:Integration Server does not return a status when this parameter is set to true.
false
Publish the document when the publish service executes.
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.