2025.03 - 2025.03

기존 확장이 어렵고, 불필요하게 나눠져있던 소스를 합쳐 Kafka 도입

Tech Stack


<aside> <img src="/icons/arrow-northeast_gray.svg" alt="/icons/arrow-northeast_gray.svg" width="40px" /> 보러가기

</aside>

//Producer
async sendMessage(payload: { pushData: string; keyversion: string; useInttId: string; correlationId: string }) {
    const parsePayload = JSON.parse(payload.pushData);
    const keyVal = {
      key: parsePayload.to || parsePayload.PUSH_ID,// token 값을 메시지 키로 사용
      value: payload           // 메시지 본문에 pushData 전체를 포함
    };
    const result$ = this.clientKafka.send(kafka_topic, keyVal);//Request-Reply 패턴

    return await lastValueFrom(result$);
}
//Consumer
private getFcmProjectId(keyversion: string, useInttId: string) {
    const conditions = [
      { predicate: () => keyversion === 'v4', result: 'push-key-3' },
      { predicate: () => keyversion === 'v3', result: 'push-key-2' },
    ];
    const foundCondition = conditions.find((cond) => cond.predicate());
    return foundCondition ? foundCondition.result : 'push-key-1';
}

기존 로직

기존 로직

배경


진행


업무성과


개인적 성장