36 lines
1.1 KiB
OpenEdge ABL
36 lines
1.1 KiB
OpenEdge ABL
public with sharing class MyContinuationController {
|
|
// Unique label that identifies the continuation
|
|
public String continuationToken;
|
|
|
|
// Result of the long-running operation
|
|
public String result {get;set;}
|
|
|
|
// Method that starts the continuation
|
|
@AuraEnabled
|
|
public Object getstartRequest() {
|
|
// Create continuation with a timeout
|
|
Continuation con = new Continuation(40);
|
|
con.continuationMethod = 'processResponse';
|
|
|
|
// Create callout request
|
|
HttpRequest req = new HttpRequest();
|
|
req.setMethod('GET');
|
|
req.setEndpoint('http://long-running-service.com');
|
|
|
|
// Add callout request to continuation
|
|
this.continuationToken = con.addHttpRequest(req);
|
|
|
|
return con;
|
|
}
|
|
|
|
// Callback method that processes the callout response
|
|
public Object processResponse() {
|
|
// Get the response by using the unique label
|
|
HttpResponse response = Continuation.getResponse(this.continuationToken);
|
|
|
|
// Set the result variable that's displayed on the Visualforce page
|
|
this.result = response.getBody();
|
|
|
|
return null;
|
|
}
|
|
} |