mirror of
https://github.com/hwanny1128/HGZero.git
synced 2026-06-13 09:29:10 +00:00
notification 실행환경 설정
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.unicorn.hgzero.notification.event;
|
||||
|
||||
import com.azure.messaging.eventhubs.models.PartitionEvent;
|
||||
import com.azure.messaging.eventhubs.models.EventContext;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.unicorn.hgzero.notification.event.event.MeetingCreatedEvent;
|
||||
import com.unicorn.hgzero.notification.event.event.TodoAssignedEvent;
|
||||
@@ -26,7 +26,7 @@ import java.util.function.Consumer;
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class EventHandler implements Consumer<PartitionEvent> {
|
||||
public class EventHandler implements Consumer<EventContext> {
|
||||
|
||||
private final NotificationService notificationService;
|
||||
private final ObjectMapper objectMapper;
|
||||
@@ -35,13 +35,13 @@ public class EventHandler implements Consumer<PartitionEvent> {
|
||||
/**
|
||||
* Event Hub 이벤트 처리
|
||||
*
|
||||
* @param partitionEvent Event Hub 파티션 이벤트
|
||||
* @param eventContext Event Hub 이벤트 컨텍스트
|
||||
*/
|
||||
@Override
|
||||
public void accept(PartitionEvent partitionEvent) {
|
||||
public void accept(EventContext eventContext) {
|
||||
try {
|
||||
// 이벤트 데이터 추출
|
||||
var eventData = partitionEvent.getData();
|
||||
var eventData = eventContext.getEventData();
|
||||
|
||||
// 이벤트 속성 추출
|
||||
Map<String, Object> properties = eventData.getProperties();
|
||||
@@ -63,8 +63,7 @@ public class EventHandler implements Consumer<PartitionEvent> {
|
||||
}
|
||||
|
||||
// 체크포인트 업데이트 (처리 성공 시)
|
||||
// TODO: Azure Event Hubs 5.x API에 맞게 체크포인트 업데이트 구현 필요
|
||||
// partitionEvent.getPartitionContext().updateCheckpointAsync().block();
|
||||
eventContext.updateCheckpoint();
|
||||
log.info("이벤트 처리 완료");
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user