Communication Component - waiting for respond if service is down

Hello everyone.

I’m trying to understand where my problem is. Most of the time the code is working just fine, but sometimes it is waiting to be respond for a long-long time.

Sometimes the service, from which I’m waiting a respond is crushed. Is there any way to find out, that it crushed and don’t wait for it?

Is there any lines (except SendWaitForReply(600000); and SLEEP(100):wink: that code from going on?

I’ve found such a function ReceiveTimeout in IMSMQBusAdapter Interface - if I put there any value - will it prevent form hanging?

CREATE(CC2);

CREATE(SBA);

CC2.AddBusAdapter(SBA,1);

OutMsg:= CC2.CreateoutMessage(‘Sockets://’ + … + ‘:’ + …);

OutStream := OutMsg.GetStream();
MessageBlob.Blob.CREATEINSTREAM(XMLStream);
COPYSTREAM(OutStream,XMLStream);

ReplyMsg := OutMsg.SendWaitForReply(600000);

IF NOT ISSERVICETIER THEN
ReplyStream := ReplyMsg.GetStream()
ELSE BEGIN
i := 0;
REPEAT
ReplyStream := ReplyMsg.GetStream();

IF ReplyStream.EOS THEN
Timeout := TRUE
ELSE BEGIN
SLEEP(100);
i += 1;
IF i = 100 THEN
Timeout := TRUE;
END;
UNTIL Timeout;
END;