using pub.publish:publish in a synchronous request/reply

Hi folks,
I am new to this forum and I want to know whether we can use pub.publish:publish service in a synchronous communication. In fact, my problem is that I have a soap request that contains an array of Funtionnal Criterias and I have to make a call to the backend for each criteria so I want to parralilize these calls . The fact is that if I use the publish and wait service when I am looping on my criterias, the service will stop execution until it gets a response !!

No. pub.publish:publish is for async activity only. publishAndWait mimics synchronous communication and must be explicitly supported by the service that is invoked in this manner (ie. it must do an explicit response).

“…the service will stop execution until it gets a response !!”

Of course. That’s the nature of synchronous communications.

Instead of trying to introduce threading (which will complicate things considerably for not much benefit) you might explore the possibility of passing the complete array to the backend and let it do the looping. Communication and control-wise that will be much easier (and faster) to do.

Forgot to ask: Does the caller to you have a user waiting on the response? If this is just an automated integration, with some program calling your service via SOAP, then it is unlikely that the amount of time spent making the calls to the backend in a serial approach is meaningful.

Thank u for your response!