Integration Server 10.3 | Publish-Subscribe Developer’s Guide | Publishing Documents | Replying to a Published or Delivered Document | Specifying the Envelope of the Received Document
 
Specifying the Envelope of the Received Document
The pub.publish:reply service contains an input parameter named receivedDocumentEnvelope. This parameter identifies the envelope of the request document for which this service creates a reply. Integration Server uses the information in the received document envelope to make sure it delivers the reply document to the correct client.
To determine where to send the reply, Integration Server first checks the value replyTo field in the received document envelope. If the replyTo field specifies a client ID to which to send responses, Integration Server delivers the reply document to that client. If the replyTo field contains no value, Integration Server sends reply documents to the publisher (which is specified in the envelope’s pubID field).
When you code a service that replies to a document, setting the receivedDocumentEnvelope parameter is optional. This field is optional because Integration Server uses the information in the received documents envelope to determine where to send the reply document.
If the service executes because two or more documents satisfied an All (AND) join condition, Integration Server uses the envelope of the last document that satisfied the join condition as the value of the receivedDocumentEnvelope parameter. For example, suppose that documentA and documentB satisfied an All (AND) join condition.
If Integration Server first receives documentA and then receives documentB, Integration Server uses the envelope of documentB as the value of receivedDocumentEnvelope. Integration Server sends the reply document only to the client identified in the envelope of documentB. If you want Integration Server to always use the envelope of documentA, link the envelope of documentA to receivedDocumentEnvelope.
Tip:
If you want a reply service to send documents to the publisher of documentA and the publisher of documentB, invoke the pub.publish:reply service once for each document. That is, you need to code your service to contain one pub.publish:reply service that responds to the publisher of documentA and a second pub.publish:reply service that responds to the sender of documentB.