I keep getting this response whenever I try to call SessionCreateRQ
<soap-env:Fault>
<faultcode>soap-env:Client.ReachedTALimit</faultcode>
<faultstring>You have reached the limit of Host TAs allocated to you</faultstring>
<detail>
<StackTrace>com.sabre.universalservices.base.exception.ApplicationICEException: errors.authentication.USG_RESOURCE_UNAVAILABLE</StackTrace>
</detail>
</soap-env:Fault>
How can I keep track of opened session, is there a way to Terminate unused active session tokens if I don't have these tokens.
The EPR you use in SessionCreateRQ is associated with a pool of connections (similar in concept to a database connection pool). Sabre support would advise you what the maximum size of that pool is. When you have the maximum number of concurrent sessions active, calling SessionCreateRQ will return the error you are getting.
SessionCloseRQ will release a connection back to the TA Pool, or they will be automatically released after 15 minutes of inactivity. If you are sharing the same pool with other EPRs (or the same EPR in different applications) and you don't have access to those session tokens, there's not much you can do to free up connections in your TA pool other than wait for those sessions to either close (via the other application calling SessionCloseRQ) or timeout.
There's a few ways to keep track of open sessions, related to connection pooling
. I've seen a database table used for this purpose. A SessionCreateRQ wrapper service was created that checked if there were any existing unused tokens in a database table. If so, that existing token is returned, otherwise the sabre SessionCreateRQ service is called to create a new token, which is then inserted into that table. A SessionCloseRQ wrapper service would mark that token as free
in the database table, without calling the underlying sabre SessionCloseRQ service. That's the high level concept and there are other implementation details that need to be considered, such as sabre transactions that might be associated with sessions if you are going to reuse them and handling free tokens that have timedout after 15 minutes and need to be removed from the table. Having that database table then gives you visibility of all the session tokens you have that are in use, or free, and lets you manage the size of the connection pool.