001/*- 002 * #%L 003 * Smile CDR - CDR 004 * %% 005 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 006 * %% 007 * All rights reserved. 008 * #L% 009 */ 010package ca.cdr.api.fhirgw.json; 011 012import ca.cdr.api.fhirgw.model.RetryStrategyEnum; 013import ca.cdr.api.model.json.IModelJson; 014import com.fasterxml.jackson.annotation.JsonProperty; 015import io.swagger.v3.oas.annotations.media.Schema; 016 017import java.util.ArrayList; 018import java.util.List; 019 020@Schema( 021 name = "GatewayTargetRetryStrategy", 022 description = "Contains configurations for the retry strategy for this target.") 023public class GatewayTargetRetryStrategyJson implements IModelJson, Cloneable { 024 025 @JsonProperty("maxRetries") 026 @Schema(description = "The number of times to retry on a failed request.") 027 private int myMaxRetries; 028 029 @JsonProperty("backoffStrategy") 030 @Schema(description = "The backoff strategy to use for failed attempts.") 031 private RetryStrategyEnum myBackoffStrategy; 032 033 @JsonProperty(value = "backoffInterval", defaultValue = "1000") 034 @Schema( 035 description = 036 "The backoff interval in milliseconds (defaulted to 1000ms). If an exponential backoff strategy is specified, this is the initial interval.") 037 private long myBackoffInterval = 1000; 038 039 @JsonProperty("errorRetryClasses") 040 @Schema( 041 description = 042 "The underlying fully qualified (ie, ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException) error class names to retry on.") 043 private List<String> myErrorRetryClasses; 044 045 public int getMaxRetries() { 046 return myMaxRetries; 047 } 048 049 public void setMaxRetries(int theMaxRetries) { 050 myMaxRetries = theMaxRetries; 051 } 052 053 public RetryStrategyEnum getBackoffStrategy() { 054 return myBackoffStrategy; 055 } 056 057 public void setBackoffStrategy(RetryStrategyEnum theBackoffStrategy) { 058 myBackoffStrategy = theBackoffStrategy; 059 } 060 061 public List<String> getErrorRetryClasses() { 062 if (myErrorRetryClasses == null) { 063 myErrorRetryClasses = new ArrayList<>(); 064 } 065 return myErrorRetryClasses; 066 } 067 068 public void setErrorRetryClasses(List<String> theErrorRetryClasses) { 069 myErrorRetryClasses = theErrorRetryClasses; 070 } 071 072 public long getBackoffInterval() { 073 return myBackoffInterval; 074 } 075 076 public void setBackoffInterval(long theBackoffInterval) { 077 myBackoffInterval = theBackoffInterval; 078 } 079}