RTC Forums
April 30, 2024, 01:11:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Session status update  (Read 3787 times)
zsleo
RTC Expired
*
Posts: 80


« on: November 19, 2015, 09:16:47 PM »

It has been a long time since I worked with RTC.

I have a existing app that I need to extend and need some advice please.

I have to implement some processing that performs many tasks against a government gateway that can take 5 minutes to more to complete and I want to provide status updates to the calling RTC client(s).

Is this achievable?

Any suggestions / examples on how to do this will be appreciated.

TIA
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: November 20, 2015, 04:20:39 PM »

In a nutshell, you could start a background task (for example, by using a TRtcQuickJob component) and poll the Server periodically to check the status.

Best Regards,
Danijel Tkalcec
Logged
zsleo
RTC Expired
*
Posts: 80


« Reply #2 on: November 23, 2015, 12:20:30 AM »

Thanks for the reply.

Will TRtcQuickJob bring back status updates for all sessions or can it be "attached" to a specific session?

To explain a little more, I could have a few hundred sessions open processing one of more than a 10 JAVA interfaces to a government services.

Each session loads its own process lists and data sets from files. Each process list can contain up to 500 individual interactions with the government service.

What I am trying to say is that returning all statuses and then decoding which are related to each user session would be a bit nightmarish.

Best Regards
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: November 23, 2015, 08:32:52 AM »

TRtcQuickJob dosn't have anything to do with Sessions and it does not bring anything "back". It is simply a way to run a "process" (a "task" or a "job") in the background, which is similar to using a TThread class from Delphi to create and run a thread. You can also use the good old TThread class from Delphi (or anything else that allows you to run a task in the background) to execute each background "process".

To get status updates to your Clients, each Client would need to poll the Server periodically (for example, using a remote function call) for a "Status Update" of its background "processes". And, ofcourse, you will need to keep track of your running "processes" (for example, in a shared list) on the Server, so you can access it from other threads to send it back to calling Client(s).

Anyway ... this is just one of way to run background tasks on the Server and provide status updates to Clients, but it doesn't solve other problems you will probably encounter in a production environment. For example, if you use a single machine for running hundreds (you are talking about 500 here) of processes parallel, with each running process slowing down all the other processes, your 5-minute tasks could end up running for hours each. Not to mention what would happen if users get annoyed and start the same task multiple times or terminate their Clients to place even more tasks into the processing queue on the Server. In short, you will need to serialize all these processes (maybe implement a "processing queue" and notify users about other running proceses and their current place in the queue) and use more machines.

Best Regards,
Danijel Tkalcec
Logged
zsleo
RTC Expired
*
Posts: 80


« Reply #4 on: November 23, 2015, 08:57:27 PM »

Thank you for the detailed reply.

- My misunderstanding. I now understand the TRTCJob purpose and functionality.
- I have coded for multiple servers and each server loading and each client will select a server with lowest loading
- I will consider your good idea with the queueing concept, thanks.

Just a small clarification. The up to 5 min is potential elapsed time and not processing time.

Best regards
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.