푸시 - 보내기 성공/실패 로그 추가
This commit is contained in:
parent
a8c3f05ffa
commit
629528b6cf
|
@ -3,11 +3,14 @@ package kr.co.vividnext.sodalive.fcm
|
||||||
import com.google.firebase.messaging.FirebaseMessaging
|
import com.google.firebase.messaging.FirebaseMessaging
|
||||||
import com.google.firebase.messaging.MulticastMessage
|
import com.google.firebase.messaging.MulticastMessage
|
||||||
import com.google.firebase.messaging.Notification
|
import com.google.firebase.messaging.Notification
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.scheduling.annotation.Async
|
import org.springframework.scheduling.annotation.Async
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class FcmService {
|
class FcmService {
|
||||||
|
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
fun send(
|
fun send(
|
||||||
tokens: List<String>,
|
tokens: List<String>,
|
||||||
|
@ -47,6 +50,8 @@ class FcmService {
|
||||||
multicastMessage.putData("content_id", contentId.toString())
|
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}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue