ialbert 2022-08-12 15:24:56 +03:00
parent 05d015fd26
commit 6ad470b67f
3 changed files with 7 additions and 1 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ target
/.idea/
*.iml
logs
tmp_notes.**

View file

@ -11,6 +11,7 @@ public class MoneyMarketCreateAction implements IAction<MoneyMarketCreateRequest
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
@JsonProperty
public Instant startDate;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Europe/Moscow")
@JsonProperty
public Instant endDate;
@JsonProperty

View file

@ -5,8 +5,11 @@ import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.common.errors.WakeupException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.spcex.clearing.platform.messaging.logic.functional.BuilderConsumerStep;
import ru.spcex.clearing.platform.messaging.logic.functional.ConsumerSpecificClass;
import ru.spcex.platform.utils.log.ExceptionUtils;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
@ -17,6 +20,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
public class QueueConsumer implements AutoCloseable {
private final Logger log = LoggerFactory.getLogger(getClass());
private final AtomicBoolean closed = new AtomicBoolean(false);
private final Consumer<String, Object> consumer;
private final ExecutorService executor;
@ -45,7 +49,7 @@ public class QueueConsumer implements AutoCloseable {
} catch (WakeupException e) {
if (!closed.get()) throw e;
} catch (Throwable e) {
throw new RuntimeException(e);
log.error(ExceptionUtils.getStackTrace(e));
} finally {
consumer.close();
}