Pausing and resuming a Liberty server from the command line

You can use the server pause or server resume commands to pause and then resume inbound work for a Liberty server. By pausing and resuming inbound work, you can isolate resources for auditing or debugging purposes without having to stop the server.

About this task

The following components can be paused:

  • HTTP endpoints

    When you pause one or more HTTP endpoints, you can isolate one or more resources that are associated with particular HTTP endpoints. The resource can be a database, for example.

    To pause or resume specific endpoints, specify the ID of each httpEndpoint element from the configuration on the --target option of the server command. For example, you can pause the db1HttpEndpoint endpoint and the db2HttpEndpoint endpoint that are in the following configuration:

    <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="8800" httpsPort="8810"/>
    <httpEndpoint id="db1HttpEndpoint" host="*" httpPort="8801" httpsPort="8811"/>
    <httpEndpoint id="db2HttpEndpoint" host="*" httpPort="8802" httpsPort="8812"/>

    To pause the endpoints, issue the following command:

    server pause server_name --target=db1HttpEndpoint,db2HttpEndpoint

    If the endpoints are configured to process HTTP requests and SSL secured HTTPS requests, pausing and resuming an endpoint applies to both communication types.

  • Message endpoints

    You can pause message-driven bean (MDB) message endpoints to prevent the endpoint from receiving messages.

    To pause or resume specific message endpoints, specify the activation name of each MDB message endpoint on the --target option of the server command. The activation name is constructed in the following format:

    ApplicationName#ModuleName#BeanName

    For example, to pause an MDB message endpoint, issue the following command:

    server pause server_name --target=MDBApplication#MDBModule.jar#Bean

Procedure

  1. Open the command line and then change the directory to the wlp/bin directory.
  2. Pause the inbound work flow controlled by pause capable components.

    For pause capable components, you can pause all the components or specific components.

    To pause all components, issue the following command:
    server pause server_name
    To pause, for example, two specific components, issue the following command:
    server pause server_name --target=target1,target2
    The values for target1 and target2 are components that can be paused for each supported protocol.
  3. Resume components that were paused.

    You can resume all components that were paused or specific components that were paused.

    To resume all components, issue the following command:
    server resume server_name
    To resume, for example, two specific components, issue the following command:
    server resume server_name --target=target1,target2
    The values for target1 and target2 are components that can be paused for each supported protocol.