-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
bump service parent pom
src/main/resources/application.yml
Outdated
| exrate: | ||
| id: etl-exchange-rate | ||
| enabled: false | ||
| consumer.group-id: "newway-exrate" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут они не будут конфликтовать с newway?
| "kafka.topics.limit-config.id", | ||
| "kafka.topics.limit-config.id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дубль
| CREATE TABLE dw.exrate | ||
| ( | ||
| id BIGSERIAL NOT NULL, | ||
| event_id uuid UNIQUE NOT NULL, | ||
| event_created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, | ||
| source_currency_symbolic_code CHARACTER VARYING NOT NULL, | ||
| source_currency_exponent SMALLINT NOT NULL, | ||
| destination_currency_symbolic_code CHARACTER VARYING NOT NULL, | ||
| destination_currency_exponent SMALLINT NOT NULL, | ||
| rational_p BIGINT NOT NULL, | ||
| rational_q BIGINT NOT NULL, | ||
| rate_timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не должно быть ex_rate? Это же от exchange_rate?
Сущность создается Exrate, хотя имхо должна быть ExRate.
mr-impossibru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не увидел тест на новое Dao, но не критично
|
|
||
| public interface ExchangeRateHandler { | ||
|
|
||
| void handle(CurrencyEvent currencyEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не хочешь сделать тут сохранение пачки?
Обычно по возможности сразу набор сущностей в БД сохраняем.
| .map(exrate -> getDslContext().newRecord(EX_RATE, exrate)) | ||
| .map(record -> (Query) getDslContext().insertInto(EX_RATE).set(record) | ||
| .onConflict(EX_RATE.EVENT_ID) | ||
| .doNothing()).collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
форматирование
.doNothing())
.collect(Collectors.toList());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо взять за правило, если линтер не тригерится, значит не считается) Но я поправлю
| CurrencyExchangeRate exchangeRate = currencyEvent.getPayload().getExchangeRate(); | ||
| ExRate exrate = new ExRate(); | ||
| exrate.setEventId(UUID.fromString(currencyEvent.getEventId())); | ||
| exrate.setEventCreatedAt(TypeUtil.stringToLocalDateTime(currencyEvent.getEventCreatedAt())); | ||
| exrate.setSourceCurrencySymbolicCode(exchangeRate.getSourceCurrency().getSymbolicCode()); | ||
| exrate.setSourceCurrencyExponent(exchangeRate.getSourceCurrency().getExponent()); | ||
| exrate.setDestinationCurrencySymbolicCode(exchangeRate.getDestinationCurrency().getSymbolicCode()); | ||
| exrate.setDestinationCurrencyExponent(exchangeRate.getDestinationCurrency().getExponent()); | ||
| exrate.setRationalP(exchangeRate.getExchangeRate().getP()); | ||
| exrate.setRationalQ(exchangeRate.getExchangeRate().getQ()); | ||
| exrate.setRateTimestamp(TypeUtil.stringToLocalDateTime(exchangeRate.timestamp)); | ||
| return exrate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опционально, не хочешь вынести в конвертер или отдельный метод внутри handler'а?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nononononono
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По-хорошему, тут везде надо рефакторить и заводить конвертеры. Ну короч хз, читабельнее щас от этого не станет. Если очень хочешь, тогда сделаю конечно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не, у меня были сомнения и я решил тебе о них сказать :)
вдруг бы тоже сомнения породил xD
add exchange rate listener
bump service parent pom