Skip to content

Commit 1423218

Browse files
committed
feat: GA4 비동기 전송용 analyticsExecutor 추가
1 parent a9b9be4 commit 1423218

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/com/ject/vs/config/AsyncConfig.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
77

88
import java.util.concurrent.Executor;
9+
import java.util.concurrent.ThreadPoolExecutor;
910

1011
@Configuration
1112
@EnableAsync
@@ -43,4 +44,17 @@ public Executor notificationExecutor() {
4344
executor.initialize();
4445
return executor;
4546
}
47+
48+
/** GA4 Measurement Protocol 전송용. 행동 로그는 양이 많아 큐를 넉넉히 두고, 넘치면 버린다(분석 데이터라 유실 허용). */
49+
@Bean("analyticsExecutor")
50+
public Executor analyticsExecutor() {
51+
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
52+
executor.setCorePoolSize(1);
53+
executor.setMaxPoolSize(4);
54+
executor.setQueueCapacity(1000);
55+
executor.setThreadNamePrefix("ga-");
56+
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
57+
executor.initialize();
58+
return executor;
59+
}
4660
}

0 commit comments

Comments
 (0)