How to reply a blank(null) document to Broker?


Say I have a publishable document MyDoc, which has a String field xyz, as part of the flow, I first go to db to get a String value, and map to, and then I do a pub.publish:reply to publish the MyDoc.

Now if the db call returns nothing, then MyDoc is not initialized and when trying to reply, I get error like “IData is a required field”.

So the question is: how can I still reply a MyDoc even if it is null? The reason for this is the caller to this service needs a return result in the form of MyDoc, so that it will know that there is no valid return, instead of getting nothing (the caller actually publish another Document to the broker which triggers this flow service, and the caller has a delivery subscription on the MyDoc document).

Thanks in advance.


From what i understood you need an empty doc in the pipeline if there is no data returned\mapped to the canonical doc from DB.

Initialize the doc with empty variables before making a call to the DB. If there is data from the DB then this doc should be populated with DB data else it will be empty and you will still have the empty IData doc.


Thanks, good idea, will give it a try