MPS サービスを開始すると、システムは自動的に MPS キューを作成します。 インターフェイスを使用して MPS キュー (パイプライン) を管理することもできます。 たとえば、SearchPipelineQueryPipelineListUpdatePipeline などがあります。

MPS キューの検索

SearchPipeline インターフェイスを使用して、MPS キュー情報を検索します。
  1. String region = “<region>”; String accessKeyId = “<accessKeyId>”; String accessKeySecret = “<accessKeySecret>”; DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret); DefaultAcsClient client = new DefaultAcsClient(profile); SearchPipelineRequest request = new SearchPipelineRequest(); // If an error occurs, it can throw ClientException or ServerException. SearchPipelineResponse response = client.getAcsResponse(request); List<SearchPipelineResponse.Pipeline> pipelines = response.getPipelineList(); for (SearchPipelineResponse.Pipeline pipeline : pipelines) { System.out.println(“pipeline id:” + pipeline.getId() + “, name:” + pipeline.getName() + “, state:” + pipeline.getState()); }
  1. </section>
  2. <section class="section" id="section-fmm-rgx-y2b">
  3. <h2 class="title sectiontitle" id="h2-url-2">MPS キューの照会</h2>
  4. <div class="p">pipelineId がわかっている場合は、pipelineId を使用することで <span class="keyword apiname">QueryPipelineList</span> インターフェイスを呼び出し、 MPS キュー情報を照会することができます。
  5. <pre class="pre codeblock"><code>String region = "&lt;region&gt;";
  6. String accessKeyId = "&lt;accessKeyId&gt;";
  7. String accessKeySecret = "&lt;accessKeySecret&gt;";
  8. // known pipeline ID, seperated by comma (,)
  9. String pipelineIds = "&lt;pipelineIds&gt;";
  10. DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
  11. IAcsClient client = new DefaultAcsClient(profile);
  12. QueryPipelineListRequest request = new QueryPipelineListRequest();
  13. request.setPipelineIds(pipelineId);
  14. //If an error occurs, it can throw ClientException or ServerException
  15. QueryPipelineListResponse response = client.getAcsResponse(request);
  16. List&lt;QueryPipelineListResponse.Pipeline&gt; pipelines = response.getPipelineList();
  17. for (QueryPipelineListResponse.Pipeline pipeline : pipelines) {
  18. System.out.println("pipeline id:" + pipeline.getId() + ", name:" + pipeline.getName() + ", state:" + pipeline.getState());
  19. }</code></pre>
  20. </div>
  21. </section>
  22. <section class="section" id="section-ddl-5gx-y2b">
  23. <h2 class="title sectiontitle" id="h2-url-3">MPS キューの更新</h2>
  24. <div class="p"><span class="keyword apiname">UpdatePipeline </span>インターフェイスを使用して、 MPS キューの名前やステータスなどの MPS キュー情報を更新します。 ステータスには Active や Paused があります。
  25. <pre class="pre codeblock"><code>String region = "&lt;region&gt;";
  26. String accessKeyId = "&lt;accessKeyId&gt;";
  27. String accessKeySecret = "&lt;accessKeySecret&gt;";
  28. DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
  29. DefaultAcsClient client = new DefaultAcsClient(profile);
  30. // Search user pipeline, the number is one by default.
  31. SearchPipelineRequest searchPipelineRequest = new SearchPipelineRequest();
  32. // If an error occurs, it can throw ClientException or ServerException.
  33. SearchPipelineResponse searchPipelineResponse = client.getAcsResponse(searchPipelineRequest);
  34. List&lt;SearchPipelineResponse.Pipeline&gt; pipelines = searchPipelineResponse.getPipelineList();
  35. SearchPipelineResponse.Pipeline queryPipeline = pipelines.get(0);
  36. //Update MPS queue status
  37. UpdatePipelineRequest request = new UpdatePipelineRequest();
  38. request.setPipelineId(queryPipeline.getId());
  39. request.setState("Paused");
  40. request.setName(queryPipeline.getName());
  41. //If an error occurs, it can throw ClientException.
  42. UpdatePipelineResponse response = client.getAcsResponse(request);
  43. UpdatePipelineResponse.Pipeline pipeline = response.getPipeline();
  44. System.out.println("pipeline id:" + pipeline.getId() + ", name:" + pipeline.getName() + ", state:" + pipeline.getState());</code></pre>
  45. </div>
  46. </section>
  47. </div>
  48. </article>
  49. </main>