Skip to content

Commit a2bdeb8

Browse files
JIWONKIMSclaude
andcommitted
revert(chat): Revert WebSocket/RabbitMQ changes
- Revert RabbitChatMessagePublisher to use RabbitTemplate - Comment out setAllowedOrigins in WebSocket configs - Comment out STOMP logging in auth interceptor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3879f87 commit a2bdeb8

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
package com.back.koreaTravelGuide.domain.userChat.chatmessage.usecase
22

3+
import org.springframework.amqp.rabbit.core.RabbitTemplate
34
import org.springframework.context.annotation.Profile
4-
import org.springframework.messaging.simp.SimpMessagingTemplate
55
import org.springframework.stereotype.Component
66

77
@Profile("prod")
88
@Component
99
class RabbitChatMessagePublisher(
10-
private val messagingTemplate: SimpMessagingTemplate,
10+
// private val messagingTemplate: SimpMessagingTemplate,
11+
private val rabbitTemplate: RabbitTemplate,
1112
) : ChatMessagePublisher {
1213
override fun publishUserChat(
1314
roomId: Long,
1415
payload: Any,
1516
) {
17+
val routingKey = "userchat.$roomId"
18+
rabbitTemplate.convertAndSend("amq.topic", routingKey, payload)
1619
// STOMP Broker Relay를 통해 RabbitMQ로 메시지 발행
1720
// enableStompBrokerRelay("/topic") 설정에 의해 자동으로 RabbitMQ STOMP Broker로 라우팅됨
18-
messagingTemplate.convertAndSend("/topic/userchat/$roomId", payload)
21+
// messagingTemplate.convertAndSend("/topic/userchat/$roomId", payload)
1922
}
2023
}

src/main/kotlin/com/back/koreaTravelGuide/domain/userChat/stomp/UserChatRabbitWebSocketConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class UserChatRabbitWebSocketConfig(
2727
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
2828
registry.addEndpoint("/ws/userchat")
2929
.setAllowedOriginPatterns("*")
30-
.setAllowedOrigins("https://www.team11.giwon11292.com", "http://localhost:3000")
30+
// .setAllowedOrigins("https://www.team11.giwon11292.com", "http://localhost:3000")
3131
.withSockJS()
3232
}
3333

src/main/kotlin/com/back/koreaTravelGuide/domain/userChat/stomp/UserChatSimpleWebSocketConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UserChatSimpleWebSocketConfig(
1717
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
1818
registry.addEndpoint("/ws/userchat")
1919
.setAllowedOriginPatterns("*")
20-
.setAllowedOrigins("https://www.team11.giwon11292.com", "http://localhost:3000")
20+
// .setAllowedOrigins("https://www.team11.giwon11292.com", "http://localhost:3000")
2121
.withSockJS()
2222
}
2323

src/main/kotlin/com/back/koreaTravelGuide/domain/userChat/stomp/UserChatStompAuthChannelInterceptor.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.back.koreaTravelGuide.domain.userChat.stomp
22

3-
import com.back.koreaTravelGuide.common.logging.log
43
import com.back.koreaTravelGuide.common.security.JwtTokenProvider
54
import org.springframework.messaging.Message
65
import org.springframework.messaging.MessageChannel
@@ -21,7 +20,7 @@ class UserChatStompAuthChannelInterceptor(
2120
): Message<*>? {
2221
val accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor::class.java) ?: return message
2322

24-
log.info("📨 [STOMP] Command: ${accessor.command}, User: ${accessor.user}, SessionId: ${accessor.sessionId}")
23+
// log.info("📨 [STOMP] Command: ${accessor.command}, User: ${accessor.user}, SessionId: ${accessor.sessionId}")
2524

2625
if (accessor.command == StompCommand.CONNECT) {
2726
val rawHeader =
@@ -32,9 +31,9 @@ class UserChatStompAuthChannelInterceptor(
3231
throw AuthenticationCredentialsNotFoundException("Invalid JWT token")
3332
}
3433
accessor.user = jwtTokenProvider.getAuthentication(token)
35-
log.info("✅ [STOMP] CONNECT authenticated: userId=${accessor.user?.name}")
34+
// log.info("✅ [STOMP] CONNECT authenticated: userId=${accessor.user?.name}")
3635
} else if (accessor.user == null) {
37-
log.error("❌ [STOMP] Unauthenticated ${accessor.command} request - SessionId: ${accessor.sessionId}")
36+
// log.error("❌ [STOMP] Unauthenticated ${accessor.command} request - SessionId: ${accessor.sessionId}")
3837
throw AuthenticationCredentialsNotFoundException("Unauthenticated STOMP request")
3938
}
4039

0 commit comments

Comments
 (0)