04-05-2019, 08:41 PM
HI ioan,
I have several endpoints that my health monitor can call. The main one is
http://beta.governmenttools.com/CrashMag...#36;LOADED
I can also call $SYSCONNECTION or $SYSTABLE to do a more thorough test. I currently only check $LOADED. I get a text when that returns FALSE.
I respond to the call from the ServerController -> BaseBeforeDispatch(). This avoids having a session created. (it also means that it checks for this specific request on every call - but that's pretty fast - just looking for '$LOADED')
```
if pos( '$LOADED', uppercase( aRequest.PathInfo )) > 0 then
begin
aResponse.WriteString( pdmisc.iif( Serving, 'TRUE', 'FALSE' ));
aResponse.Expires := now;
Handled := true;
end
```
When I upgraded to IW 15, I started moving things over to CustomContent handlers. So I've also got this:
http://beta.governmenttools.com/CrashMag...36;Version
If I understand it correctly, I've specified that a session is not needed for this call. I'm not exactly sure when custom handlers get checked and how they affect sessions if they don't need one. I don't worry too much about spinning up new sessions as long as they are destroyed when done. I also require a login to get a "real" session - and that's the more heavy-weight session.
The nice thing about any of these solutions is that you're not just testing for a response, but you can do any processing you like before responding. You can even return different results if your monitor supports it.
Hope that helps.
Pete
I have several endpoints that my health monitor can call. The main one is
http://beta.governmenttools.com/CrashMag...#36;LOADED
I can also call $SYSCONNECTION or $SYSTABLE to do a more thorough test. I currently only check $LOADED. I get a text when that returns FALSE.
I respond to the call from the ServerController -> BaseBeforeDispatch(). This avoids having a session created. (it also means that it checks for this specific request on every call - but that's pretty fast - just looking for '$LOADED')
```
if pos( '$LOADED', uppercase( aRequest.PathInfo )) > 0 then
begin
aResponse.WriteString( pdmisc.iif( Serving, 'TRUE', 'FALSE' ));
aResponse.Expires := now;
Handled := true;
end
```
When I upgraded to IW 15, I started moving things over to CustomContent handlers. So I've also got this:
http://beta.governmenttools.com/CrashMag...36;Version
If I understand it correctly, I've specified that a session is not needed for this call. I'm not exactly sure when custom handlers get checked and how they affect sessions if they don't need one. I don't worry too much about spinning up new sessions as long as they are destroyed when done. I also require a login to get a "real" session - and that's the more heavy-weight session.
The nice thing about any of these solutions is that you're not just testing for a response, but you can do any processing you like before responding. You can even return different results if your monitor supports it.
Hope that helps.
Pete