Using the Publish and Wait

I’m building an Integration that is Publishing a Document (Input)and Waiting for a Reply(Output). My second Integration uses the Input performs a process and Publishes the Output Document. But the initial Integration is not receiving the Output Document. In my Publish and wait step I have coded in the Properties both the Publish Document and the Reply Document Id’s. I can see my see second Integration working correcly including the Publish Output but the original Integration is not picking it up.

Thanks for any assistance you may provide!!

Hi Tony,

You need to deliver the reply. This will require using an output step instead of a publish step - the output step will deliver the document when the script finishes.

Hope this helps,
Tara

in the second integration, make sure the properties of the output is set to delivery.

Are the two Integrations on the same adapter. If it is, then you have problem. Because the default of adapter setting is one thread, and calling publishRequestAndWait will be blocking and the second Integration doesn’t have change to process it. To make it works, you have to set adapter in multi processes or multi threads (your choice).

Hope it helps,
Dylan

Hello,

I have a similar kind of requirement where in i need to call three systems in parallel and aggregate the response in the main calling service. I do not like to call the three systems in sequence in order to avoid the time lag.I do not like to use modeler, is there any other way, like multi threading calls to different systems from the same service.

Thanks,
KK.

Read the Publish-Subscribe Developer’s Guide for information about asynchronous request/reply.

Before doing so, I would suggest finding out if calling each system in turn actually incurs a meaningful “time lag”. Calling each in turn would result in an easier-to-understand-and-maintain service. Introducing multi-threading MIGHT be faster but it is definitely more complex. My suggestion is to not introduct the complexity until you know that it is faster and that the speed increase is meaningful.

For example, if publishing the 3 requests and gathering the 3 replies in a multi-threaded manner saves 90 seconds of execution time, does anyone notice or care? If not, then saving that 90 seconds is useless.

Just my opinion.

Hi Rob,

Thanks much for the response. In my case i have SLA of 3 seconds to meet in the project. So i feel the multi threading way is most appropriate to achieve the SLA. DO you have any sample java code which implement that multi threading calls.

TIA
KK

My point was to not make assumptions about which approach is faster. Multi-threading may or may not be faster. And if the non-threaded approach meets your SLA, then it seems better to use the simpler approach. You’ll need to measure.

You don’t need to use Java. The Pub-Sub guide describes how to pub multiple requests and then retrieve the replies.