1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 | using IndianHealthService.BMXNet.Services;
|
---|
5 |
|
---|
6 | namespace IndianHealthService.BMXNet
|
---|
7 | {
|
---|
8 |
|
---|
9 | /// <summary>
|
---|
10 | /// <para>
|
---|
11 | /// Each BMX connection to RPMS contains a single RemoteSessionPool with at least
|
---|
12 | /// one Session, the primary session. Applications that need additional server processes
|
---|
13 | /// beyond what can be done with async commands can used the RemoteSessionPool.
|
---|
14 | /// </para>
|
---|
15 | /// <para>
|
---|
16 | /// Access to the RemoteSessionPool is accomplished by implementing the RemoteSessionPoolConsumer
|
---|
17 | /// interface on your component/control. Secondary sessions can be opened and closed as they
|
---|
18 | /// are needed. If the AvailableSessionCount is zero then a null RemoteSession is returned so it
|
---|
19 | /// is recommend to first check the if a pool HasAvailableSessions before an OpenSession() request.
|
---|
20 | /// </para>
|
---|
21 | /// <para>
|
---|
22 | /// RemoteSessionPool high-performance can be achieved by keeping RPMS server jobs alive even after
|
---|
23 | /// secondary sessions are closed. The pool will maintain MaxSessions - 1 number of jobs alive on the
|
---|
24 | /// server. If the application is finished for awhile needing IdleSessionCount idle jobs, then
|
---|
25 | /// TerminateIdleSessions() will release those resources on the server. New jobs will then be created
|
---|
26 | /// on demand.
|
---|
27 | /// </para>
|
---|
28 | ///
|
---|
29 | /// </summary>
|
---|
30 | public interface RemoteSessionPool
|
---|
31 | {
|
---|
32 | /// <summary>
|
---|
33 | /// True if another secondary session can be opened.
|
---|
34 | /// </summary>
|
---|
35 | /// <remarks>
|
---|
36 | /// For this version of BMX, the EHR does not support secondary RemoteSessions and this
|
---|
37 | /// method always returns false. If possible, develop your software using the API so when
|
---|
38 | /// secondary RemoteSessions are supported your application will work.
|
---|
39 | /// </remarks>
|
---|
40 | bool HasAvailableSession { get; }
|
---|
41 |
|
---|
42 | /// <summary>
|
---|
43 | /// The number of additional secondary RemoteSessions that can be opened.
|
---|
44 | /// </summary>
|
---|
45 | int AvailableSessionCount { get; }
|
---|
46 |
|
---|
47 | /// <summary>
|
---|
48 | /// The maximum number of RemoteSessions than can be opened
|
---|
49 | /// </summary>
|
---|
50 | int MaxSessions { get; set; }
|
---|
51 |
|
---|
52 | /// <summary>
|
---|
53 | /// Open a RemoteSession and answer it. If an idle Session exists, it will be recycled
|
---|
54 | /// and answered. Use Close() on the RemoteSession to release this secondary RemoteSession
|
---|
55 | /// back to the pool.
|
---|
56 | /// </summary>
|
---|
57 | /// <returns>A newly created or recycled RemoteSession or null if the number of RemoteSessions has reach the MaxSessions count</returns>
|
---|
58 | RemoteSession OpenSession();
|
---|
59 |
|
---|
60 | /// <summary>
|
---|
61 | /// Open a new RemoteSession and answer it. If an idle Session exists, it will be recycled
|
---|
62 | /// and answered. Use Close() on the RemoteSession to release this secondary RemoteSession
|
---|
63 | /// back to the pool. An implementation of Log can be included to trace RPC execution.
|
---|
64 | /// </summary>
|
---|
65 | /// <remarks>
|
---|
66 | /// Logging is not heavily used in BMXNET40
|
---|
67 | /// </remarks>
|
---|
68 | /// <returns>A newly created or recycled RemoteSession or null if the number of RemoteSessions has reach the MaxSessions count</returns>
|
---|
69 | RemoteSession OpenSession(Log aLog);
|
---|
70 |
|
---|
71 | //Idle session management
|
---|
72 | int IdleSessionCount { get; }
|
---|
73 | void TerminateIdleSessions();
|
---|
74 |
|
---|
75 | //Lifecycle
|
---|
76 | void Close();
|
---|
77 |
|
---|
78 |
|
---|
79 | }
|
---|
80 | }
|
---|