edit-icon download-icon

Delete CID

Last Updated: Oct 09, 2018

This interface is exclusive for MQ Platinum edition users. For more information, go to Platinum Edition Purchase Page.

Description

OnsSubscribeDelete interface deletes a subscription relation previously created with the OnsSubscribeCreate interface.

Usage

When an application is disabled and MQ resources need to be destroyed, you can call the OnsSubscribeDelete interface to delete the subscription relation.

Request parameters

Name Type Required Description
OnsRegionId String Yes The region where the queried MQ is currently located. It can be obtained through the OnsRegionList method.
OnsPlatform String No The source of the request, which by default is POP platform.
PreventCache Long Yes It’s used for CSRF verification. Set it to the current system time.
ConsumerId String Yes CID of the message consumption cluster to be deleted

Response parameters

Name Type Description
RequestId String A public parameter unique for each request
HelpUrl String A help link
  • OnsSubcribbeCreate: creates a subscription relation
  • OnsSubscribeList: queries a list of subscription relations

Example

  1. public static void main(String []args) {
  2. String regionId = "cn-hangzhou";
  3. String accessKey = "XXXXXXXXXXXXXXXXX";
  4. String secretKey = "XXXXXXXXXXXXXXXXX";
  5. String endPointName ="cn-hangzhou";
  6. String productName ="Ons";
  7. String domain ="ons.cn-hangzhou.aliyuncs.com";
  8. /**
  9. *Select Region based on the region you will access, and set the corresponding access point.
  10. */
  11. try {
  12. DefaultProfile.addEndpoint(endPointNameregionIdproductNamedomain);
  13. } catch (ClientException e) {
  14. e.printStackTrace();
  15. }
  16. IClientProfile profile= DefaultProfile.getProfile(regionIdaccessKeysecretKey);
  17. IAcsClient iAcsClient= new DefaultAcsClient(profile);
  18. OnsSubscriptionDeleteRequest request = new OnsSubscriptionDeleteRequest();
  19. /**
  20. *OnsRegionId refers to the resource of the region of MQ required to be accessed by API.
  21. *This value must be selected and configured by the list obtained through the OnsRegionList method because OnsRegionId is changing, and cannot be written as a fixed value.
  22. */
  23. request.setOnsRegionId("daily");
  24. request.setPreventCache(System.currentTimeMillis());
  25. request.setAcceptFormat(FormatType.JSON);
  26. request.setTopic("Mingduan_67dd");
  27. request.setConsumerId("CID_MingduanTest");
  28. try {
  29. OnsSubscriptionDeleteResponse response=iAcsClient.getAcsResponse(request);
  30. System.out.println(response.getRequestId());
  31. } catch (ServerException e) {
  32. e.printStackTrace();
  33. } catch (ClientException e) {
  34. e.printStackTrace();
  35. }
  36. }
Thank you! We've received your feedback.