Search in sources :

Example 66 with TargetDeliveryResponse

use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.

the class DefaultTargetClient method getOffersAsync.

@Override
public CompletableFuture<TargetDeliveryResponse> getOffersAsync(TargetDeliveryRequest request) {
    try {
        Objects.requireNonNull(request, "request cannot be null");
        CompletableFuture<TargetDeliveryResponse> targetDeliveryResponse;
        DecisioningMethod decisioningMethod = getDecisioningMethod(request);
        updatePropertyToken(request);
        if (decisioningMethod == DecisioningMethod.ON_DEVICE || (decisioningMethod == DecisioningMethod.HYBRID && localService.evaluateLocalExecution(request).isAllLocal())) {
            targetDeliveryResponse = localService.executeRequestAsync(request);
        } else {
            targetDeliveryResponse = targetService.executeRequestAsync(request);
        }
        return targetDeliveryResponse;
    } catch (Exception e) {
        TargetRequestException targetRequestException = new TargetRequestException(e.getMessage(), e, request);
        logger.error(targetRequestException.getMessage());
        throw targetRequestException;
    }
}
Also used : TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException) DecisioningMethod(com.adobe.target.edge.client.model.DecisioningMethod) TargetRequestException(com.adobe.target.edge.client.exception.TargetRequestException)

Aggregations

TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)66 TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)58 Test (org.junit.jupiter.api.Test)53 TimingTool (com.adobe.target.edge.client.utils.TimingTool)13 DeliveryResponse (com.adobe.target.delivery.v1.model.DeliveryResponse)10 Context (com.adobe.target.delivery.v1.model.Context)9 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)9 TargetTestDeliveryRequestUtils.getContext (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext)9 TargetTestDeliveryRequestUtils.getMboxExecuteRequest (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest)9 TargetTestDeliveryRequestUtils.getTestDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse)9 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)8 Property (com.adobe.target.delivery.v1.model.Property)7 TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse)6 Telemetry (com.adobe.target.delivery.v1.model.Telemetry)5 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)4 ParamsCollator (com.adobe.target.edge.client.ondevice.collator.ParamsCollator)4 CustomerState (com.adobe.experiencecloud.ecid.visitor.CustomerState)3 TargetRequestException (com.adobe.target.edge.client.exception.TargetRequestException)3 ResponseStatus (com.adobe.target.edge.client.http.ResponseStatus)3 ResponseWrapper (com.adobe.target.edge.client.http.ResponseWrapper)3