Restricting Connections on the Server Side
You can restrict both total connections to the Universal Messaging server and the number of
connections for a specific user by setting the MaxNoOfConnections
and
MaxNoOfConnectionsPerUserName
properties, respectively. You configure the
properties on the Connection Config tab for a server instance in the
Enterprise Manager:
- MaxNoOfConnections. Sets the total number of
concurrent connections to the server. Valid values range from
-1
(default), which means an unlimted number of connections, to2147483647
. - MaxNoOfConnectionsPerUserName. Sets the number of
concurrent connections that a specific user can make to the server. Valid values range
from
-1
(default), which means an umlimited number of connections, to2147483647
.
Restrict Connections per User
To restrict the number of concurrent connections per user on the server, you configure the
MaxNoOfConnectionsPerUserName
property. The user name, which is part of
the username@host
subject, is the one provided when authenticating the
session, typically when the session is created using
nSessionFactory.create(). If the user name is not provided, the default
user is used, which is the operating system user running the operating system process of the
client application, or the certificate subject (CN) when SSL with client authentication is
used.
After you set this property, the server rejects any connections that are created after the connection limit is reached. The rejected session returns an nSecurityException with the reason why it is rejected.
For example, you can set MaxNoOfConnectionsPerUserName
to
5
for the user testuser
. If testuser
tries to create six connections, after reaching the connection limit of 5
,
any upcoming connection will be rejected and the client will receive the following
exception: "com.pcbsys.nirvana.client.nSecurityException: Server has rejected the
connection due to reaching maximum allowable connections for user: testuser@127.0.0.1
current connections: 5 user limit: 5
".
Restrict Total Connections
To restrict the total number of concurrent connections to the server regardless of user,
you configure the MaxNoOfConnections
property. After you set this property,
the server rejects any connections for any user after the connection limit is reached. The
rejected session returns an nSecurityException with the reason why it is rejected.
For example, if you set MaxNoOfConnections
to 52
, for any
user who tries to connect after the limit is reached, the client will receive the following
exception: "com.pcbsys.nirvana.client.nSecurityException: Server has rejected the
connection due to reaching maximum allowable global connections for user: user0@127.0.0.1
current connections: 52 limit: 52
".
Restrict Both Connections per User and Total Connections
To restrict both total connections and the connections made per user, you configure both
the MaxNoOfConnections
and MaxNoOfConnectionsPerUserName
properties, respectively. MaxNoOfConnections
must always have a higher
value than MaxNoOfConnectionsPerUserName
. If the value of
MaxNoOfConnections
is lower, when the server reaches the limit for total
connections it will stop accepting connections, although the limit set in
MaxNoOfConnectionsPerUserName
has not been reached.