Publishing documents Broker/Trigger


I have a main service and I need to call two auxiliar services in paralel that will return a document each one.

So, in my main service I publish a document and I have two triggers waiting this document. The first trigger calls the auxiliar service “ServiceOne” and the second calls “ServiceTwo”.

Alright, that’s working, but…

These two auxiliary services should return a document to my main service, once I’m using pub:pusblish:publishAndWait but nothing is returning!

Can someone help me?


What are the inputs passed to the service pub:pusblish:publishAndWait ?

documentTypeName: Passing the full name of my publishable document
document: Passing the publishable document

If I use only this two inputs, the service don’t stop running.

Then I use:
receiveDocumentTypeName: The name of the document that I’m expecting
waitTime: Sometimes I use 5000 cause if I leave blank the service don’t stop running.

Note: Do I need to set up receiveDocumentTypeName? Because I’m waiting two documents.

Yes. Can you please try giving receiveDocumentTypeName

receiveDocumentTypeName - Fully qualified name of the document type expected as a reply. If no value is specified, the service uses the first reply document of any type it receives, as long as the value of tag in the reply document envelope matches the tag in the envelope of the published document. All other reply documents are discarded.

Any input passed to “async” ?

The return still the same passing receiveDocumentTypeName, the service don’t stop running.

No, async is blank! I tried using true and false but no success.

Can you share your code to me?

Let me know if I am wrong :smiley:

1> Main service will publish a doc to broker say pubDoc
2> pubDoc is subscribed by the trigger_1 and trigger_2
3> svc_1 and svc_2 will (publish and wait) a document that should go to main service
4> Do we have one more trigger to subscribe the above document?

Meanwhile we have a example code sample for pub wait and subscribe at the link below:

Looking for your example I saw an error on mine, calling pub.publish:reply. Thaaaanks!
Alright, now the document is returning, but…

The main service calls two triggers in paralel, and the triggers calls two services, great… but the main service receives the first reply and go on, it didn’t wait the second reply.

There´s a way to main service wait for the two replies?


Can you check for JOIN conditions in trigger.

It’s blocked and selected “All(AND)”

Can you please read the PDF Publish-Subscribe Developer’s Guide - Software AG Documentation

Very useful :smiley:

Join conditions are of 3 types AND, OR and XOR.

Please study the chap. Understanding Join Conditions. This gives you the solution :slight_smile:

You can write your logic untill you receive the two documents. Something like doc1 AND doc2.


I saw that I need to use two publishAndWait using “true” in “async” and after that just get all results!