Starting, restarting and stopping the MQ Connectivity process by using REST Administration APIs

System administrators can start, restart and stop the MQ Connectivity process by using REST Administration APIs.

About this task

When the MQ Connectivity process is stopped, the durable subscriptions that are used to receive published messages remain active. Therefore, any messages that are published while the MQ Connectivity process is stopped are delivered as soon as the process is restarted. As the messages are buffered, the maximum messages limit of the destination mapping rules might be reached. This limit prevents publishers from sending any more messages. If you do not want this behavior, or if you are stopping the MQ Connectivity process for a long time, disable all the destination mapping rules before you stop the process. For more information about disabling destination mapping rules, see Configuring destination mapping rules by using the IBM Watson IoT Platform - Message Gateway Web UI.

You can start, restart and stop the MQ Connectivity process by using REST Administration APIs. You can restart and stop the MQ Connectivity process by using the IBM Watson IoT Platform - Message Gateway Web UI. For more information about using the IBM Watson IoT Platform - Message Gateway Web UI, see Restarting, stopping, and viewing the status of MQ Connectivity by using the IBM Watson IoT Platform - Message Gateway Web UI.

Procedure

  1. Check the status of the MQ Connectivity process by using the IBM Watson IoT Platform - Message Gateway REST API GET method with the following IBM Watson IoT Platform - Message Gateway service URI:

    http://<admin-endpoint-IP:port>/ima/v1/service/status/MQConnectivity

    • If the status is Active, the MQ Connectivity process is running. You can stop the process.
    • If the status is Inactive, the MQ Connectivity process is not running. You can start or restart the MQ Connectivity process. To start the MQ Connectivity process, MQConnectivity must be enabled or the process will fail to start. Setting MQConnectivityEnabled to true automatically starts the MQ Connectivity process.

      To enable MQ Connectivity, use the IBM Watson IoT Platform - Message Gateway REST API POST method with the following IBM Watson IoT Platform - Message Gateway configuration URI:

      http://<admin-endpoint-IP:port>/ima/v1/configuration

      You can provide configuration data in the payload of the POST method by using the following schema:
      
      {
         "MQConnectivityEnabled": true
       }
  2. Choose an appropriate action:
    • To start the MQ Connectivity process by restarting the server, use the IBM Watson IoT Platform - Message Gateway REST API POST method with the following IBM Watson IoT Platform - Message Gateway configuration URI:

      http://<admin-endpoint-IP:port>/ima/v1/service/restart

      Provide object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json:

      
      { "Service": "Server" }

      When the server restarts, MQ Connectivity also restarts if it is enabled.

      If the server does not start, check the logs for messages. For more information about the log files, see Log files.

    • To start the MQ Connectivity process, without restarting the server, use the IBM Watson IoT Platform - Message Gateway REST API POST method with the following IBM Watson IoT Platform - Message Gateway service URI:

      http://<admin-endpoint-IP:port>/ima/v1/service/start

      You can provide configuration data in the payload of the POST method by using the following schema:
      
      {"Service":"MQConnectivity"}
       
    • To restart the MQ Connectivity process, without restarting the server, use the IBM Watson IoT Platform - Message Gateway REST API POST method with the following IBM Watson IoT Platform - Message Gateway service URI:

      http://<admin-endpoint-IP:port>/ima/v1/service/restart

      You can provide configuration data in the payload of the POST method by using the following schema:
      
      {"Service":"MQConnectivity"}
       
    • To stop the MQ Connectivity process without stopping the server, use the IBM Watson IoT Platform - Message Gateway REST API POST method with the following IBM Watson IoT Platform - Message Gateway service URI:

      http://<admin-endpoint-IP:port>/ima/v1/service/stop

      You can provide configuration data in the payload of the POST method by using the following schema:
      
      {"Service":"MQConnectivity"}
       

Example

The following example uses cURL to show the status of the MQ Connectivity process:

curl -X GET http://127.0.0.1:9089/ima/v1/service/status/MQConnectivity
 
 

The following example shows a successful example response to the GET method:


{    
  "Version":"v1",    
    "MQConnectivity": {
     "Status": "Active",     
     "Enabled": true    
    } 
}

The following example uses cURL to stop the MQ Connectivity process:


curl -X POST \
   -H 'Content-Type: application/json'  \
   -d  '{     
         "Service":"MQConnectivity"
      }
 '  \
http://127.0.0.1:9089/ima/v1/service/stop
 
 

Check the status of the MQ Connectivity process after running the POST method:

curl -X GET http://127.0.0.1:9089/ima/v1/service/status/MQConnectivity
 
 

The following example shows a successful example response to the GET method:


{
  "Version":"v1",
  "MQConnectivity": {
    "Status": "Inactive",
    "Enabled": true
  }
}