Closing client connections

You can close client connections by using a REST Administration API. You can specify one or more attributes to identify the connections to close. The attributes that you can specify are the client ID, the client IP address, and the user ID of the client.

If the object configuration parameter that is specified in the REST Administration API applies to more than one client connection, all applicable client connections are closed. Therefore, ensure that you specify a parameter that does not apply to more client connections than the ones you want to close.

Do not use this command unless you are certain that the connection needs to be closed. Unnecessarily closing connections can affect performance.

  • To close client connections, use the Eclipse Amlen REST API POST method with the following Eclipse Amlen configuration URI:
    http://<admin-endpoint-IP:Port>/ima/v1/service/close/connection
  • Provide object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json:
    
    { 
        "ClientID":"string", 
        "ClientAddress":"string",
        "UserID":"string" 
    }
    Where:
    ClientID
    Specifies the client ID of the connection, or connections, that you want to close.
    ClientAddress
    Specifies the IP address of the connection, or connections, that you want to close.
    UserID
    Specifies the user ID of the connection, or connections, that you want to close.
    Note: You must specify at least one of the object configuration data parameters. The use of wildcard characters is permitted. You can specify more than one value by using a comma separated list.

The following example shows the POST method to close all connections with Client ID Client38104 or Client ID Client38105 by using cURL:


curl -X POST \
   -H 'Content-Type: application/json'  \
   -d ' { 
         "ClientID":"Client38104,Client38105"
        }
 '  \
http://127.0.0.1:9089/ima/v1/service/close/connection

The following shows an example response to the POST method:


{ 
   "Version":"v1",
   "Code":"CWLNA6137",
   "Message":"The specified connections were closed. Number of connections closed = 2" 
}
Verify that all the connections are closed, by re-issuing the same REST API POST method that you used in the previous example:

curl -X POST  \    
   -H 'Content-Type: application/json'  \    
   -d '  {
         "ClientID":"Client38104,Client38205"
         }
      ' \ 
http://127.0.0.1:9089/ima/v1/service/close/connection 
The following example response to the re-issued POST command is expected:

{ 
   "Version":"v1",
   "Code":"CWLNA6136",
   "Message":"The specified connection was not closed. The specified connection cannot be found." 
}