Skip to content

Commit 81a4ae5

Browse files
docs(microservices): kafka retriable exceptions update
1 parent a5e2447 commit 81a4ae5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

content/microservices/kafka.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ If your handler involves a slow processing time for each received message you sh
349349
@MessagePattern('hero.kill.dragon')
350350
async killDragon(@Payload() message: KillDragonMessage, @Ctx() context: KafkaContext) {
351351
const heartbeat = context.getHeartbeat();
352-
352+
353353
// Do some slow processing
354354
await doWorkPart1();
355355

@@ -417,6 +417,8 @@ onModuleInit() {
417417

418418
Similar to other transporters, all unhandled exceptions are automatically wrapped into an `RpcException` and converted to a "user-friendly" format. However, there are edge-cases when you might want to bypass this mechanism and let exceptions be consumed by the `kafkajs` driver instead. Throwing an exception when processing a message instructs `kafkajs` to **retry** it (redeliver it) which means that even though the message (or event) handler was triggered, the offset won't be committed to Kafka.
419419

420+
> warning **Warning** For event handlers (event-based communication), all unhandled exceptions are considered **retriable exceptions** by default.
421+
420422
For this, you can use a dedicated class called `KafkaRetriableException`, as follows:
421423

422424
```typescript

content/migration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ killDragon(@Payload() message: KillDragonMessage, @Ctx() context: KafkaContext)
7979
}
8080
```
8181

82+
#### Kafka retriable errors
83+
84+
In v9, we introduced the **[Retriable exceptions](/microservices/kafka#retriable-exceptions)** feature. Note: for event handlers (**event-based communication**) all unhandled exceptions become "retriable exceptions" by default, and so they will be auto-delivered.
85+
8286
#### Fastify
8387

8488
Fastify has been upgraded to v4. Also, all of the core Fastify plugins that were prefixed with `fastify-` are now renamed and published under the `@fastify` scope (for example, `fastify-cookie` becomes `@fastify/cookie`, `fastify-helmet` becomes `@fastify/helmet`, etc.). Read more [here](https://github.com/fastify/fastify/issues/3856).

0 commit comments

Comments
 (0)