edit-icon download-icon

Delete PID

Last Updated: Apr 08, 2018

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

Description

OnsPublishDelete interface deletes published PIDs.

Usage

This interface is called to delete the existing publishing relation when an application is disabled or the resource needs to be released. Make sure that the publishing relation already exists before deleting.

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.
ProducerId String No PID of the publishing relation to be deleted.
Topic String Yes Topic corresponding to the publishing relation to be deleted.

Response parameters

Name Type Description
RequestId String A public parameter unique for each request
HelpUrl String A help link
  • OnsPublishCreate: creates a publishing relation
  • OnsPublishList: retrieves a list of publishing relations
  • OnsPublishGet: queries a publishing relation

Example

The following example is to delete a relation of a PID with the name of “PID_MingduanTest” in the daily region.

This example shows the process of deleting a PID relation named “PID_MingduanTest” in the daily region.

  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. OnsPublishDeleteRequest request = new OnsPublishDeleteRequest();
  19. /**
  20. *OnsRegionId refers to the resource of the region of ONS 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.setProducerId("PID_MingduanTest");
  28. try {
  29. OnsPublishDeleteResponse 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.