Skip to content

Commit

Permalink
Add payload to listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Fagorym committed Apr 4, 2024
1 parent 46ce3d9 commit 2f7fe4e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaHandler;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import ru.nsu.fit.directors.userservice.event.BusinessMessageEvent;
import ru.nsu.fit.directors.userservice.service.ChatService;
Expand All @@ -18,8 +19,8 @@
public class ChatTopicListener {
private final ChatService chatService;

@KafkaHandler
public void handleMessage(BusinessMessageEvent businessMessageEvent) {
@KafkaHandler(isDefault = true)
public void handleMessage(@Payload BusinessMessageEvent businessMessageEvent) {
log.info("Receive business message {}", businessMessageEvent);
chatService.handleMessage(businessMessageEvent);
}
Expand Down

0 comments on commit 2f7fe4e

Please sign in to comment.