edit-icon download-icon

Configure CID permission

Last Updated: Oct 17, 2018

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


OnsSubscribeUpdate interface sets the permission to read a message for a specified Consumer ID.


You can configure a switch of message reading for a Consumer ID determined by your specified MQ region and Consumer ID name. This is usually used for preventing a specific Consumer ID from reading messages.

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 The name of Consumer ID to be configured
ReadEnable Boolean Yes It sets a switch of message reading.

Response parameters

Name Type Description
RequestId String A public parameter unique for each request
HelpUrl String A help link
  • OnsSubcribeCreate: creates a subscription relation
  • OnsSubcribeDelete: deletes a subscription relation
  • OnsSubscribeGet: precisely queries a subscription relation


As a reference, this example shows the process of accessing from the end point China East, and disabling the message reading permission of the Consumer ID “CID_001”.

  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. OnsSubscriptionUpdateRequest request = new OnsSubscriptionUpdateRequest();
  19. request.setAcceptFormat(FormatType.JSON);
  20. request.setConsumerId("CID_001");
  21. /**
  22. *OnsRegionId refers to the resource of the region of MQ required to be accessed by API.
  23. *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.
  24. */
  25. request.setOnsRegionId("daily");
  26. request.setPreventCache(System.currentTimeMillis());
  27. request.setReadEnable(false);//2 indicates "write-only"; 4 indicates "read-only"; 6 indicates "read/write supported".
  28. try {
  29. OnsSubscriptionUpdateResponse response = IAcsClient.getAcsResponse(request);
  30. System.out.println(response.getRequestId());
  31. }
  32. catch (ServerException e) {
  33. e.printStackTrace();
  34. }
  35. catch (ClientException e) {
  36. e.printStackTrace();
  37. }
  38. catch (Exception e) {
  39. e.printStackTrace();
  40. }
  41. }
Thank you! We've received your feedback.