Communication Component - waiting for respond if service is down

Astinia
Member Posts: 40
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);) 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;
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);) 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;
0
Answers
-
[Topic moved from 'NAV Tips & Tricks' forum to 'NAV Three Tier' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hello, quite old, but i have similar problem and can not solve it out....
Is it possible to manage it that "SendWaitForReply(10000)" will not crash with error
after timeout ?
I need to do some code when timeout passes, not to throw that error and stop.
Thank you.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions