Quantcast
Channel: VMware Communities : Unanswered Discussions - VMTN
Viewing all articles
Browse latest Browse all 61567

BlockingTask.getBlockingTaskById

$
0
0

Trying to use the "upper level" APIs for vCloud Director Java. To be specific those available in the packages com.vmware.vcloud.sdk.admin.extensions and com.vmware.vcloud.sdk.maas, notably Notification and BlockingTask in concert with RabbitMQ.

 

 

The snippet of code is:

 

QueueingConsumer.Delivery delivery = consumer.nextDelivery();
System.out.println( "a message arrived" );
Notification notification = createNotification( delivery );
System.out.println("     Headers:");

for (String headerName : notification.getNotificationHeaders().keySet()) {
    System.out.println("          " + headerName + " - " + notification.getNotificationHeaders().get(headerName));
}

System.out.println("     Properties:");
System.out.println("          Organization Name  - " + notification.getOrgLink().getName());
System.out.println("          Organization Id    - " + notification.getOrgLink().getId());
System.out.println("          User Name          - " + notification.getUserLink().getName());
System.out.println("          User Id            - " + notification.getUserLink().getId());
System.out.println("          Event Id           - " + notification.getResource().getEventId());
System.out.println("          Timestamp          - " + notification.getResource().getTimestamp());
System.out.println("          Is Blocking        - " + notification.isBlockingTask());

if( notification.isBlockingTask() ) {
    System.out.println("          Blocking Task Name - " + notification.getBlockingTaskLink().getName());
    System.out.println("          Blocking Task Id   - " + notification.getBlockingTaskLink().getId());
    System.out.println("          Blocking Task Rel  - " + notification.getBlockingTaskLink().getRel() );
    System.out.println("          Blocking Task Type - " + notification.getBlockingTaskLink().getType() );
    BlockingTask bt = BlockingTask.getBlockingTaskById( vcloudClient,
                                                notification.getBlockingTaskLink().getId() );
}
which produces the (sample) output:
Headers:
    notification.entityType - com.vmware.vcloud.entity.blockingTask
    notification.type - com/vmware/vcloud/event/blockingtask/create
    notification.operationSuccess - true
    notification.entityUUID - f80cd469-fb7d-46c2-94fc-fea8d02e40f8
    notification.userUUID - 3d967671-ab04-44a9-9f8a-62caea0f3ade
    notification.orgUUID - 56173d0c-90f7-47ef-9f29-b58b0a2716e4
Properties:
    Organization Name  - XXXXX
    Organization Id    - urn:vcloud:org:56173d0c-90f7-47ef-9f29-b58b0a2716e4
    User Name          - administrator
    User Id            - urn:vcloud:user:3d967671-ab04-44a9-9f8a-62caea0f3ade
    Event Id           - c6689ab6-51e9-4b6f-94df-f16c4ef32608
    Timestamp          - 2031-07-26T12:30:58.460-04:00
    Is Blocking        - true
    Blocking Task Name - vappUpdateVm
    Blocking Task Id   - urn:vcloud:blockingTask:f80cd469-fb7d-46c2-94fc-fea8d02e40f8
    Blocking Task Rel  - entity
    Blocking Task Type - vcloud:blockingTask

 

However, the last statement of the sample always generates an exception:

 

    VCloudException: e=Reference Not Found

 

i.e. the method invocation BlockingTask.getBlockingTaskById( vcloudClient, notification.getBlockingTaskLink().getId() ) fails.

 

The vCloud Director Javadoc for Notification for the method getBlockingTaskLink is:

 

getBlockingTaskLink

public EntityLinkType getBlockingTaskLink()
                                   throws VCloudException
If the notification is for blocking operation, returns the blocking request link. This blocking task link contains the vcloud id of the blockingTask. This id can be used in theBlockingTask.getBlockingTaskById(com.vmware.vcloud.sdk.VcloudClient, String)

 

Returns:
EntityLinkType
Throws:
VCloudException

 

The question is then - bug or incorrect usage on my part?


Viewing all articles
Browse latest Browse all 61567


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>