Cumulocity-IoT / c8y-adamos-hub-connector

Cumulocity IoT ADAMOS HUB Connector
Apache License 2.0
1 stars 1 forks source link

Catch 429 errors in Hub Connector #24

Closed haraldmeyer closed 1 year ago

haraldmeyer commented 1 year ago

ADAMOS Hub may return 429 error codes. These are currently not handled properly.

`2022-10-26 05:07:17.533 WARN 13 --- [scheduling-1] c.c.m.context.ContextServiceImpl : execution of task failed within tenant : t51394749 - 429 Too Many Requests: [

429 Too Many Requests

429 Too Many Requests


nginx

] 2022-10-26 05:07:17.533 ERROR 13 --- [scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task

org.springframework.web.client.HttpClientErrorException$TooManyRequests: 429 Too Many Requests: [

429 Too Many Requests

429 Too Many Requests


nginx

] at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:137) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:186) at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:125) at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:819) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:777) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:621) at com.adamos.hubconnector.services.EventRulesService.restToHub(EventRulesService.java:145) at com.adamos.hubconnector.services.EventRulesService.lambda$consumeC8YEvent$0(EventRulesService.java:134) at com.cumulocity.microservice.context.ContextServiceImpl$CallableRunnableWrapper.call(ContextServiceImpl.java:119) at com.cumulocity.microservice.context.ContextServiceImpl$CallableRunnableWrapper.call(ContextServiceImpl.java:109) at com.cumulocity.microservice.context.ContextServiceImpl.callWithinContext(ContextServiceImpl.java:78) at com.cumulocity.microservice.context.ContextServiceImpl.runWithinContext(ContextServiceImpl.java:66) at com.cumulocity.microservice.subscription.service.impl.MicroserviceSubscriptionsServiceImpl.runForEachTenant(MicroserviceSubscriptionsServiceImpl.java:235) at com.adamos.hubconnector.services.EventRulesService.consumeC8YEvent(EventRulesService.java:119) at jdk.internal.reflect.GeneratedMethodAccessor175.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

`