Search in sources :

Example 1 with ResponseWrapper

use of com.adobe.target.edge.client.http.ResponseWrapper in project target-java-sdk by adobe.

the class DefaultTargetService method executeNotification.

@Override
public ResponseStatus executeNotification(TargetDeliveryRequest deliveryRequest) {
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    NotificationService.setBeaconToFalse(deliveryRequest.getDeliveryRequest());
    TargetDeliveryResponse targetDeliveryResponse;
    Telemetry telemetry = telemetryService.getTelemetry();
    if (!telemetry.getEntries().isEmpty()) {
        deliveryRequest.getDeliveryRequest().setTelemetry(telemetry);
    }
    ResponseWrapper response = callDeliveryApi(deliveryRequest);
    targetDeliveryResponse = getTargetDeliveryResponse(deliveryRequest, response.getHttpResponse());
    telemetryService.addTelemetry(deliveryRequest, timer, targetDeliveryResponse, response.getParsingTime(), response.getResponseSize());
    return new ResponseStatus(response.getHttpResponse().getStatus(), response.getHttpResponse().getStatusText());
}
Also used : TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) ResponseStatus(com.adobe.target.edge.client.http.ResponseStatus) ResponseWrapper(com.adobe.target.edge.client.http.ResponseWrapper) Telemetry(com.adobe.target.delivery.v1.model.Telemetry)

Example 2 with ResponseWrapper

use of com.adobe.target.edge.client.http.ResponseWrapper in project target-java-sdk by adobe.

the class DefaultTargetService method executeRequestAsync.

@Override
public CompletableFuture<TargetDeliveryResponse> executeRequestAsync(TargetDeliveryRequest deliveryRequest) {
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    Telemetry telemetry = telemetryService.getTelemetry();
    if (!telemetry.getEntries().isEmpty()) {
        deliveryRequest.getDeliveryRequest().setTelemetry(telemetry);
    }
    CompletableFuture<ResponseWrapper<DeliveryResponse>> responseCompletableFuture = callDeliveryApiAsync(deliveryRequest);
    return responseCompletableFuture.thenApply(response -> {
        TargetDeliveryResponse targetDeliveryResponse = getTargetDeliveryResponse(deliveryRequest, response.getHttpResponse());
        telemetryService.addTelemetry(deliveryRequest, timer, targetDeliveryResponse, response.getParsingTime(), response.getResponseSize());
        return targetDeliveryResponse;
    });
}
Also used : TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) ResponseWrapper(com.adobe.target.edge.client.http.ResponseWrapper) Telemetry(com.adobe.target.delivery.v1.model.Telemetry)

Example 3 with ResponseWrapper

use of com.adobe.target.edge.client.http.ResponseWrapper in project target-java-sdk by adobe.

the class DefaultTargetService method executeNotificationAsync.

@Override
public CompletableFuture<ResponseStatus> executeNotificationAsync(TargetDeliveryRequest deliveryRequest) {
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    NotificationService.setBeaconToFalse(deliveryRequest.getDeliveryRequest());
    Telemetry telemetry = telemetryService.getTelemetry();
    if (!telemetry.getEntries().isEmpty()) {
        deliveryRequest.getDeliveryRequest().setTelemetry(telemetry);
    }
    CompletableFuture<ResponseWrapper<DeliveryResponse>> responseCompletableFuture = callDeliveryApiAsync(deliveryRequest);
    return responseCompletableFuture.thenApply(response -> {
        TargetDeliveryResponse targetDeliveryResponse = getTargetDeliveryResponse(deliveryRequest, response.getHttpResponse());
        telemetryService.addTelemetry(deliveryRequest, timer, targetDeliveryResponse, response.getParsingTime(), response.getResponseSize());
        return new ResponseStatus(response.getHttpResponse().getStatus(), response.getHttpResponse().getStatusText());
    });
}
Also used : TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) ResponseStatus(com.adobe.target.edge.client.http.ResponseStatus) ResponseWrapper(com.adobe.target.edge.client.http.ResponseWrapper) Telemetry(com.adobe.target.delivery.v1.model.Telemetry)

Aggregations

Telemetry (com.adobe.target.delivery.v1.model.Telemetry)3 ResponseWrapper (com.adobe.target.edge.client.http.ResponseWrapper)3 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)3 TimingTool (com.adobe.target.edge.client.utils.TimingTool)3 ResponseStatus (com.adobe.target.edge.client.http.ResponseStatus)2