|
1 | 1 | # Upgrading Guide |
2 | 2 |
|
3 | | -We have introduced the following breaking changes on version `12.0.0`, please follow the steps below to update your code |
4 | | -from the previous version to the new one. |
| 3 | +## Upgrading from `12.0.0` to `13.0.0` |
5 | 4 |
|
6 | | -## Breaking Changes |
| 5 | +### Description of Breaking Change |
| 6 | +- The property `prehandlers` has been updated to `preHandler` for consumers. |
| 7 | +- In the SQS and SNS consumer, `consumerOverrides` no longer permits the alteration of critical properties such as |
| 8 | + `sqs`, `queueUrl`, `handler`, and `handleMessageBatch` to prevent confusion and maintain proper functionality of |
| 9 | + the consumer. |
| 10 | +- The `consumerOverrides` in the SQS and SNS consumer no longer includes the option to define the `visibilityTimeout` |
| 11 | + property, as it is now automatically determined by the consumer from the `creationConfig` or queue configuration in the |
| 12 | + case of `locatorConfig`. |
| 13 | + |
| 14 | +### Migration Steps |
| 15 | +#### preHandlers |
| 16 | +If you currently utilize the `prehandlers` property in your consumer, it will be necessary to update it to `preHandler`. |
| 17 | + |
| 18 | +#### ConsumerOverrides |
| 19 | +If you are implementing the `consumerOverrides` property in your consumer, it is essential to eliminate the properties |
| 20 | +`sqs`, `queueUrl`, `handler`, `handleMessageBatch`, and `visibilityTimeout`. |
| 21 | +- `sqs` should be included in the constructor dependencies |
| 22 | +- `queueUrl` is managed automatically by the library and does not require manual specification |
| 23 | +- `handleMessageBatch` is not supported by the library |
| 24 | +- `visibilityTimeout` is automatically managed by the library and does not need explicit declaration |
| 25 | +- For the `handler`, use the `handler` property in the constructor as demonstrated below |
| 26 | +```typescript |
| 27 | +export class MyConsumer extends AbstractAmqpConsumer<MyType, undefined> { |
| 28 | + public static QUEUE_NAME = 'my-queue-name' |
| 29 | + |
| 30 | + constructor(dependencies: AMQPConsumerDependencies) { |
| 31 | + super( |
| 32 | + dependencies, |
| 33 | + { |
| 34 | + creationConfig: { |
| 35 | + queueName: AmqpPermissionConsumer.QUEUE_NAME, |
| 36 | + queueOptions: { durable: true, autoDelete: false }, |
| 37 | + }, |
| 38 | + messageTypeField: 'messageType', |
| 39 | + handlers: new MessageHandlerConfigBuilder<SupportedEvents, ExecutionContext>() |
| 40 | + .addConfig( |
| 41 | + MY_MESSAGE_SCHEMA, |
| 42 | + async (message) => { |
| 43 | + // Your handling code |
| 44 | + return { |
| 45 | + result: 'success', |
| 46 | + } |
| 47 | + }, |
| 48 | + ) |
| 49 | + .build(), |
| 50 | + }, |
| 51 | + undefined |
| 52 | + ) |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +## Upgrading from `11.0.0 `to `12.0.0` |
7 | 58 |
|
8 | 59 | ### Description of Breaking Change |
9 | 60 | Multi consumers and publishers can accomplish the same tasks as mono ones, but they add extra layer of complexity by |
|
0 commit comments