Skip to content

Feature/bjs2 97222#2172

Open
wersatil wants to merge 4 commits intophoenix-master-stream12from
feature/BJS2-97222
Open

Feature/bjs2 97222#2172
wersatil wants to merge 4 commits intophoenix-master-stream12from
feature/BJS2-97222

Conversation

@wersatil
Copy link
Copy Markdown

No description provided.

@wersatil wersatil changed the base branch from dev to phoenix-master-stream12 December 16, 2025 19:12
private String bootstrapServers;

@Bean
public ProducerFactory<String, PostEvent> postKafkaProducerFactory() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь может универсальный ProducerFactory сделать, чтоб не создавать бин под каждое событие?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, ты прав. Павел просил не делать универсальным в Consumer. А в Produser можно сделать и универсальным. Сейчас поменяю.

}

@Bean
public KafkaTemplate<String, PostEvent> postKafkaTemplate(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну и здесь тоже, отдельный template для эвента

@Transactional
public boolean publishPost(long requesterId, long postId) {
public void publishPost(long requesterId, long postId) {
Optional<Post> optionalPostToPublish = postRepository.findById(postId);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно заменить:
Post post = postRepository.findById(postId)
.orElseThrow(() -> new EntityNotFoundException(
"Данный пост не существует, его невозможно опубликовать."
));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно ) Это - очень старый код (первая половина октября), когда я увидел его, я всерьез задумался о том, чтобы полностью переписать его под чистую, тут все очень плохо. Я сел, внимательно посчитал примерное время на это и профит, и решил не тратить на это 1-2 дня, поскольку там придется и контроллер переписывать, и маппер, и все тесты.

postRepository.save(postToPublish);
log.info("Пост с id: {} успешно опубликован пользователем с id: {}.", postId, requesterId);
return true;
List<Long> followerIds = userServiceClient.getFollowers(requesterId).stream()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут вижу только проблему в том что userServiceClient может вернуть ну очень большой список и надо работать с пагинацие, но если там ее нет то ок

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants