[ 
https://issues.apache.org/jira/browse/JCLOUDS-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16012048#comment-16012048
 ] 

Andrea Turli edited comment on JCLOUDS-1298 at 5/16/17 9:19 AM:
----------------------------------------------------------------

Interesting! I wonder if we could generalize ProfitBricks approach to have an 
annotation for the method we want to explicitly block, something like a 
ResponseTransformer
i.e.:
{code:java}
   @Named("CreateOrUpdateVirtualMachine")
   @PUT
   @MapBinder(BindToJsonPayload.class)
   @Path("/{vmname}")
   @QueryParams(keys = "validating", values = "false")
   @ResponseTransformer(...)
   VirtualMachine blockingCreateOrUpdate(@PathParam("vmname") String vmname,
                                 @PayloadParam("location") String location,
                                 @PayloadParam("properties") 
VirtualMachineProperties properties,
                                 @PayloadParam("tags") Map<String, String> tags,
                                 @Nullable @PayloadParam("plan") Plan plan);
{code}


was (Author: andreaturli):
Interesting! I wonder if we could generalize ProfitBricks approach to have an 
annotation for the method we want to explicitly block, something like a 
ResponseTransformer
i.e.:
{quote}
   @Named("CreateOrUpdateVirtualMachine")
   @PUT
   @MapBinder(BindToJsonPayload.class)
   @Path("/{vmname}")
   @QueryParams(keys = "validating", values = "false")
   @ResponseTransformer(...)
   VirtualMachine blockingCreateOrUpdate(@PathParam("vmname") String vmname,
                                 @PayloadParam("location") String location,
                                 @PayloadParam("properties") 
VirtualMachineProperties properties,
                                 @PayloadParam("tags") Map<String, String> tags,
                                 @Nullable @PayloadParam("plan") Plan plan);
{quote}

> [Azure ARM] Handle async operations
> -----------------------------------
>
>                 Key: JCLOUDS-1298
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1298
>             Project: jclouds
>          Issue Type: Improvement
>          Components: jclouds-compute
>    Affects Versions: 2.0.1
>            Reporter: Svetoslav Neykov
>              Labels: azurecompute-arm
>
> Azure's API could choose to continue an operation as async if it takes too 
> long to complete. To let the client know it should continue polling for the 
> result it includes the operation URL in an {{Azure-AsyncOperation}} header.
> The client is supposed to poll the operation URL (the value of the header) 
> before declaring success/failure.
> With the current implementation an operation could still be in progress and 
> jclouds return a success result. The {{provisioningState}} property would 
> still be in an {{Updating}} state.
> Proposal:
> When the response contains the {{Azure-AsyncOperation}} header don't return 
> yet, but wait for the state to transition to success/failure before giving 
> control back to the caller.
> Related to https://issues.apache.org/jira/browse/JCLOUDS-1296; If operations 
> block and the result is not used until success of the operation, instances of 
> "409 Conflict" responses should decrease dramatically.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to