푸시 - 보내기 성공/실패 로그 추가

This commit is contained in:
Klaus 2023-08-21 01:10:05 +09:00
parent a8c3f05ffa
commit 629528b6cf
1 changed files with 6 additions and 1 deletions

View File

@ -3,11 +3,14 @@ package kr.co.vividnext.sodalive.fcm
import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.messaging.MulticastMessage
import com.google.firebase.messaging.Notification
import org.slf4j.LoggerFactory
import org.springframework.scheduling.annotation.Async
import org.springframework.stereotype.Service
@Service
class FcmService {
private val logger = LoggerFactory.getLogger(this::class.java)
@Async
fun send(
tokens: List<String>,
@ -47,6 +50,8 @@ class FcmService {
multicastMessage.putData("content_id", contentId.toString())
}
FirebaseMessaging.getInstance().sendEachForMulticast(multicastMessage.build())
val response = FirebaseMessaging.getInstance().sendEachForMulticast(multicastMessage.build())
logger.info("보내기 성공: ${response.successCount}")
logger.info("보내기 실패: ${response.failureCount}")
}
}