#Kafka Async Handler

1 messages · Page 1 of 1 (latest)

timber thunder
#

Hey everyone! I have issue with handling async Event Pattern messages from other service, once one event(or event batch) is accepted and is on process, its not accepting any other
`@EventPattern('token.fetchMomentum')
async fetchMomentum(@Payload() data: any, @Ctx() context: KafkaContext) {
const { offset } = context.getMessage();
const partition = context.getPartition();
const topic = context.getTopic();

console.log('GOT EVENT FETCH MOMENTUM');
try {
  await this.sleep(10000); // your processing logic here
  console.log('GOT EVENT FETCH MOMENTUM NEXT');
  return 'YES';
} catch (error) {
  console.error(error);
  throw error;
}

}`

cold whale
#

You mean it's not consuming other messages after it's done with one?

#

Or that it's not processing a new message until it's done with the previous one? Because this is exactly the behavior that kafka is built for. A strictly sequential processing (within a topic/partition)

timber thunder