Partial Playback Follow
Partial Playback means that a FORMS/HTML service session may be kept open (up to a certain threshold), and resumed later by another service from the very same point where the previous service finished.
Why use Partial service?
We would always prefer to use full service whenever possible.
Advantages of Full Service: simpler, encapsulated, stable, no connections are kept open after playback.
Disadvantages: more Forms sessions, runs the whole scenario from beginning every time.
On the other hand, partial services requires finer control of the developer: it is his responsibility to keep relevant connections open, resume previous services from the correct point, and remember to shut down connections when necessary.
Partial Services shall be used when:
- Scenario includes looping over given set of operations, such as in insertion of table rows.
- There are performance requirements (and running full service from beginning takes considerable time).
- Scenario have a lot of conditions and branches that might lead to different Form interactions.
Note that partial services are not recommended when a user action is expected, since the session might time out after a few minutes/seconds.
You may use partial services directly from your app, or combine them using a Process.
Prerequisites & configuration
By default, partial recording is disabled to prevent basic users from misuse (as partial playback is required only for advanced Form scenarios).
To enable partial recording in your ServiceManager, open Admin > System Properties, and set the following property:
ALLOW_PARTIAL_RECORDINGS = true |
Also, the following properties define the Paused Connections behavior:
SESSION_MANAGER_PARTIAL_SESSIONS_TIMEOUT_SECONDS = 180 SESSION_MANAGER_CLEANUP_PERIODIC_DELAY_SECONDS = 60 |
- SESSION_MANAGER_PARTIAL_SESSIONS_TIMEOUT_SECONDS: threshold for paused connections - connections remaining unused longer than this time period will be closed by the next iteration of the connections cleaner.
- SESSION_MANAGER_CLEANUP_PERIODIC_DELAY_SECONDS: delay between executions of the paused connections cleaner.
Note: paused connections are considered as active/in-use connections regarding SESSION_MANAGER_CORE_POOL_SIZEand SESSION_MANAGER_MAX_POOL_SIZE.
Recording: First service
The first service in each sequence of partially played services must be a full standard service - as the Form must undergo full initialization before use.
Record this service as any other non-partial service - once finished click "Save & Pause" on the recording toolbar.
The Service Editor window will open, where you configure and save the service.
Once you completed and saved your service, go back to the browser window that runs the recording toolbar.
Recording: Partial services
Before continuing to your partial recording, make sure that the Form is in correct state - if necessary make now any screen navigation, data preparations etc.
When ready to start your next partial recording, click on the "Resume Record" button.
Perform your Form scenario, and finally click either "Save & Pause" or "Save & Exit" to save the recording.
Playback: First service
The first service in each sequence of partially played services must be a full standard service, and its connection must be kept open in order to be able resume it by a partial service.
In playback, keep the session alive by passing keepAlive=true in the query (or alternatively in POST request body). For example:
http: //<host>:<port>/ServiceManager/Macro/ExecMacro/mcs_getCustomer?keepAlive=true |
Once a service requested to keep its session alive, and only upon successful execution, it will generate a unique sessionId that identifies the open connection.
We will use this sessionId when resuming a paused session.
keepAlive=true must be passed to every service in the execution sequense (full and partials), besides the last service.
When keepAlive is set to false (or not set) - the ServiceManager will shut down the connection immediately as the played scenario ends.
Playback: Partial services
Partial services can be identified by the "Partial: Yes" line in Service Editor > Advanced Details.
Partial service must receive a valid sessionId, of the session they need to resume - this could be provided either in query or in POST request body. For example,
http: //<host>:<port>/ServiceManager/Macro/ExecMacro/partialInsert?sessionId=2181232&keepAlive=true |
Also you would like to pass keepAlive=true to any service (besides the last service), to keep the connection open for the next partial services.
sessionId will remain unchanged if the service is resuming a previous session - same sessionId that the service received as input will be returned in its output.
Paused sessions listing
Your Service Manager displays paused sessions in Admin > Sessions, in the same tables as pre-oppened / in-use connection.
Paused sessions are represented as lines with non-empty Session Id.
Killing a session
As mentioned above, you may close an open connection by passing keepAlive=false to the last service in your execution sequence.
Sometimes it might be required to kill a session manually - e.g. as in cases that only client side decides when a loop ends, or as client encounters an error which is not a service error.
You may close a connection by making HTTP DELETE api call to your Service Manager:
http: //<host>:<port>/ServiceManager/Macro/Sessions/<sessionId> |
Upon successful termination, the paused session will no longer appear in Admin > Sessions, and you'll receive the following success response:
{ "success" : true , "objectName" : "" } |
Comments
0 comments
Please sign in to leave a comment.