edit-icon download-icon

MPS queues management

Last Updated: May 01, 2018

The system automatically creates an MPS queue when you open the MPS service. You can also manage the MPS queue (pipeline) by using interfaces. For example, SearchPipeline, QueryPipelineList and UpdatePipeline.

Search MPS queue

You can search the MPS queue information by using the SearchPipeline interface.

  1. String region = "<region>";
  2. String accessKeyId = "<accessKeyId>";
  3. String accessKeySecret = "<accessKeySecret>";
  4. DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
  5. DefaultAcsClient client = new DefaultAcsClient(profile);
  6. SearchPipelineRequest request = new SearchPipelineRequest();
  7. // If an error occurs, it can throw ClientException or ServerException
  8. SearchPipelineResponse response = client.getAcsResponse(request);
  9. List<SearchPipelineResponse.Pipeline> pipelines = response.getPipelineList();
  10. for (SearchPipelineResponse.Pipeline pipeline : pipelines) {
  11. System.out.println("pipeline id:" + pipeline.getId() + ", name:" + pipeline.getName() + ", state:" + pipeline.getState());
  12. }

Query MPS queue

If you know the pipelineId, you can use pipelineId to call QueryPipelineList interface to query MPS queue information.

  1. String region = "<region>";
  2. String accessKeyId = "<accessKeyId>";
  3. String accessKeySecret = "<accessKeySecret>";
  4. // known pipeline ID, seperated by comma (,)
  5. String pipelineIds = "<pipelineIds>";
  6. DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
  7. DefaultAcsClient client = new DefaultAcsClient(profile);
  8. QueryPipelineListRequest request = new QueryPipelineListRequest();
  9. request.setPipelineIds(pipelineId);
  10. // If an error occurs, it can throw ClientException or ServerException
  11. QueryPipelineListResponse response = client.getAcsResponse(request);
  12. List<QueryPipelineListResponse.Pipeline> pipelines = response.getPipelineList();
  13. for (QueryPipelineListResponse.Pipeline pipeline : pipelines) {
  14. System.out.println("pipeline id:" + pipeline.getId() + ", name:" + pipeline.getName() + ", state:" + pipeline.getState());
  15. }

Update MPS queue

Use the UpdatePipeline interface to update MPS queue information, including MPS queue name and status. The status includes Active and Paused.

  1. String region = "<region>";
  2. String accessKeyId = "<accessKeyId>";
  3. String accessKeySecret = "<accessKeySecret>";
  4. DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
  5. DefaultAcsClient client = new DefaultAcsClient(profile);
  6. // Search user pipeline, the number is one by default
  7. SearchPipelineRequest searchPipelineRequest = new SearchPipelineRequest();
  8. // If an error occurs, it can throw ClientException or ServerException.
  9. SearchPipelineResponse searchPipelineResponse = client.getAcsResponse(searchPipelineRequest);
  10. List<SearchPipelineResponse.Pipeline> pipelines = searchPipelineResponse.getPipelineList();
  11. SearchPipelineResponse.Pipeline queryPipeline = pipelines.get(0);
  12. // Update MPS queue status
  13. UpdatePipelineRequest request = new UpdatePipelineRequest();
  14. request.setPipelineId(queryPipeline.getId());
  15. request.setState("Paused");
  16. request.setName(queryPipeline.getName());
  17. // If an error occurs, it can throw ClientException.
  18. UpdatePipelineResponse response = client.getAcsResponse(request);
  19. UpdatePipelineResponse.Pipeline pipeline = response.getPipeline();
  20. System.out.println("pipeline id:" + pipeline.getId() + ", name:" + pipeline.getName() + ", state:" + pipeline.getState());
Thank you! We've received your feedback.