Bad Gateway or Connection Timeout While Using JMS Fleets API

If you encounter a bad gateway or a connection time out while using the JMS Fleets API, try the following solutions:
  • Use the SDK for Java to invoke the JMS Fleets API
  • Reduce page size from 1000 to get 500-800 records per page
  • Configure the retry strategy to retry in case of failure, as shown in the example:
    final long DEFAULT_MAX_WAIT_TIME = TimeUnit.SECONDS.toMillis(40L);
    final int DEFAULT_MAX_RETRY_ATTEMPTS = 9;
    RetryConfiguration retryConfiguration = RetryConfiguration.builder().terminationStrategy(new MaxAttemptsTerminationStrategy(DEFAULT_MAX_RETRY_ATTEMPTS))
            .delayStrategy(new ExponentialBackoffDelayStrategyWithJitter(DEFAULT_MAX_WAIT_TIME)).terminationStrategy(new MaxAttemptsTerminationStrategy(DEFAULT_MAX_RETRY_ATTEMPTS))
            .delayStrategy(new ExponentialBackoffDelayStrategyWithJitter(DEFAULT_MAX_WAIT_TIME)).retryCondition((exception) ->     exception.getStatusCode() == 429
                    || exception.getStatusCode() == 502
                    || exception.getStatusCode() == 503
                    || exception.getStatusCode() == 504).build(); 
  • Increase the client timeout duration, as shown in the example:
    ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                    .connectionTimeoutMillis(30000)
                    .readTimeoutMillis(30000)
                    .retryConfiguration(retryConfiguration)
                    .build();
  • Limit invoking JMS Fleets API calls concurrently to less than ten requests per second