Unverified Commit 0748d3d3 authored by Hong Minhee's avatar Hong Minhee
Browse files

Add native retrial support to AmqpMessageQueue

- Add nativeRetrial option to AmqpMessageQueueOptions
- When enabled, messages are not acknowledged on processing failure
- Update documentation and examples in README
- Add comprehensive tests for retrial behavior
- Update dependencies to support new functionality

https://github.com/fedify-dev/fedify/issues/250
parent bc8a5574
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -30,6 +30,17 @@ const federation = createFederation({
});
~~~~

The `AmqpMessageQueue` constructor accepts options as the second
parameter, which can be used to configure the message queue:

~~~~ typescript
new AmqpMessageQueue(await connect("amqp://localhost"), {
  queue: "my_queue",
})
~~~~

For more details, please refer to the docs of [`AmqpMessageQueueOptions`].

[JSR]: https://jsr.io/@fedify/amqp
[JSR badge]: https://jsr.io/badges/@fedify/amqp
[npm]: https://www.npmjs.com/package/@fedify/amqp
@@ -41,6 +52,7 @@ const federation = createFederation({
[`KvStore`]: https://jsr.io/@fedify/fedify/doc/federation/~/KvStore
[`MessageQueue`]: https://jsr.io/@fedify/fedify/doc/federation/~/MessageQueue
[`AmqpMessageQueue`]: https://jsr.io/@fedify/amqp/doc/mq/~/AmqpMessageQueue
[`AmqpMessageQueueOptions`]: https://jsr.io/@fedify/amqp/doc/mq/~/AmqpMessageQueueOptions


Installation
@@ -72,6 +84,9 @@ Changelog

To be released.

 -  Added `nativeRetrial` option to `AmqpMessageQueueOptions` to enable
    native retrial of messages.

 -  The type of the `AmqpMessageQueue()` constructor's first parameter has been
    changed from `Connection` to `ChannelModel`.

+2 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@
    "./mq": "./src/mq.ts"
  },
  "imports": {
    "@alinea/suite": "jsr:@alinea/suite@^0.6.2",
    "@fedify/fedify": "jsr:@fedify/fedify@^1.5.0",
    "@fedify/fedify": "jsr:@fedify/fedify@^1.7.0-dev.887+013dabb5",
    "@hongminhee/suite": "jsr:@hongminhee/suite@^0.6.3",
    "@std/assert": "jsr:@std/assert@^1.0.13",
    "@std/async": "jsr:@std/async@^1.0.13",
    "amqplib": "npm:amqplib@^0.10.8",
+14 −14
Original line number Diff line number Diff line
{
  "version": "5",
  "specifiers": {
    "jsr:@alinea/suite@~0.6.2": "0.6.2",
    "jsr:@es-toolkit/es-toolkit@^1.38.0": "1.39.3",
    "jsr:@fedify/fedify@^1.5.0": "1.6.1",
    "jsr:@fedify/fedify@^1.7.0-dev.887+013dabb5": "1.7.0-pr.251.885+560fd10f",
    "jsr:@hongminhee/suite@~0.6.3": "0.6.3",
    "jsr:@hugoalh/http-header-link@^1.0.2": "1.0.3",
    "jsr:@hugoalh/is-string-singleline@^1.0.4": "1.0.5",
    "jsr:@logtape/logtape@0.11": "0.11.0",
    "jsr:@std/assert@^1.0.13": "1.0.13",
    "jsr:@std/async@^1.0.13": "1.0.13",
    "jsr:@std/internal@^1.0.6": "1.0.8",
    "npm:@alinea/suite@~0.6.2": "0.6.2",
    "npm:@hongminhee/suite@~0.6.3": "0.6.3",
    "npm:@js-temporal/polyfill@~0.5.1": "0.5.1",
    "npm:@multiformats/base-x@^4.0.1": "4.0.1",
    "npm:@opentelemetry/api@^1.9.0": "1.9.0",
@@ -33,14 +33,11 @@
    "npm:url-template@^3.1.1": "3.1.1"
  },
  "jsr": {
    "@alinea/suite@0.6.2": {
      "integrity": "067948595ee65876c3d76ae40fdf6f321a4afab3566da5ca259559490c95da23"
    },
    "@es-toolkit/es-toolkit@1.39.3": {
      "integrity": "edd98c3eac732730b61bac8952a31633a778a236e1be144aa32b220c152d1fbe"
    },
    "@fedify/fedify@1.6.1": {
      "integrity": "e5712a15c50d8836e6ad617aefa69bb601b12ac335526c54a7ffe339b0128e0c",
    "@fedify/fedify@1.7.0-pr.251.885+560fd10f": {
      "integrity": "fb60eaac1b902f32bddbc1ea0171b2bf4903345a497d3aff693ea290f1abc585",
      "dependencies": [
        "jsr:@es-toolkit/es-toolkit",
        "jsr:@hugoalh/http-header-link",
@@ -60,6 +57,9 @@
        "npm:url-template"
      ]
    },
    "@hongminhee/suite@0.6.3": {
      "integrity": "429be25d44f30525fcc7ee60e4879e8abc2e09ab625d006c5bd0605e9e8e393c"
    },
    "@hugoalh/http-header-link@1.0.3": {
      "integrity": "3372096a73d755e3351f7fbd7155db7725874c2682a594a655580e3866563024",
      "dependencies": [
@@ -86,9 +86,6 @@
    }
  },
  "npm": {
    "@alinea/suite@0.6.2": {
      "integrity": "sha512-UEYs2OLLb5DCMVE/0C8AAhP+xjKdOujbfL+NIXtcCW0dyeQqxjRVVFu+JH5VsjNxkx9ZNgId0fU4HkoKRU49CQ=="
    },
    "@babel/generator@7.27.5": {
      "integrity": "sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw==",
      "dependencies": [
@@ -149,6 +146,9 @@
    "@fastify/busboy@2.1.1": {
      "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="
    },
    "@hongminhee/suite@0.6.3": {
      "integrity": "sha512-jW0scPczSP5Mksq49c9stYIApHGijodCFvpKRcFAWImn5WRs4kVlzNwz9QpblaAvoErN8UsfP7OZl3mIk0VoLA=="
    },
    "@jridgewell/gen-mapping@0.3.8": {
      "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
      "dependencies": [
@@ -664,8 +664,8 @@
  },
  "workspace": {
    "dependencies": [
      "jsr:@alinea/suite@~0.6.2",
      "jsr:@fedify/fedify@^1.5.0",
      "jsr:@fedify/fedify@^1.7.0-dev.887+013dabb5",
      "jsr:@hongminhee/suite@~0.6.3",
      "jsr:@std/assert@^1.0.13",
      "jsr:@std/async@^1.0.13",
      "npm:amqplib@~0.10.8",
@@ -673,7 +673,7 @@
    ],
    "packageJson": {
      "dependencies": [
        "npm:@alinea/suite@~0.6.2",
        "npm:@hongminhee/suite@~0.6.3",
        "npm:@js-temporal/polyfill@~0.5.1",
        "npm:@types/amqplib@~0.10.7",
        "npm:tsdown@~0.12.7",
+5 −5
Original line number Diff line number Diff line
@@ -35,8 +35,12 @@
    },
    "./package.json": "./package.json"
  },
  "peerDependencies": {
    "@fedify/fedify": "^1.7.0-dev.887",
    "amqplib": "^0.10.8"
  },
  "devDependencies": {
    "@alinea/suite": "^0.6.2",
    "@hongminhee/suite": "^0.6.3",
    "@js-temporal/polyfill": "^0.5.1",
    "@std/assert": "jsr:^1.0.13",
    "@std/async": "jsr:^1.0.13",
@@ -44,10 +48,6 @@
    "tsdown": "^0.12.7",
    "typescript": "^5.8.3"
  },
  "peerDependencies": {
    "@fedify/fedify": "^1.5.0",
    "amqplib": "^0.10.8"
  },
  "scripts": {
    "build": "tsdown",
    "prepack": "tsdown",
+13 −13
Original line number Diff line number Diff line
@@ -9,15 +9,15 @@ importers:
  .:
    dependencies:
      '@fedify/fedify':
        specifier: ^1.5.0
        version: 1.6.1(web-streams-polyfill@3.3.3)
        specifier: ^1.7.0-dev.887
        version: 1.7.0-pr.251.886(web-streams-polyfill@3.3.3)
      amqplib:
        specifier: ^0.10.8
        version: 0.10.8
    devDependencies:
      '@alinea/suite':
        specifier: ^0.6.2
        version: 0.6.2
      '@hongminhee/suite':
        specifier: ^0.6.3
        version: 0.6.3
      '@js-temporal/polyfill':
        specifier: ^0.5.1
        version: 0.5.1
@@ -39,9 +39,6 @@ importers:

packages:

  '@alinea/suite@0.6.2':
    resolution: {integrity: sha512-UEYs2OLLb5DCMVE/0C8AAhP+xjKdOujbfL+NIXtcCW0dyeQqxjRVVFu+JH5VsjNxkx9ZNgId0fU4HkoKRU49CQ==}

  '@babel/generator@7.27.5':
    resolution: {integrity: sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw==}
    engines: {node: '>=6.9.0'}
@@ -83,10 +80,13 @@ packages:
    resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==}
    engines: {node: '>=14'}

  '@fedify/fedify@1.6.1':
    resolution: {integrity: sha512-KPfy4ETv96smVH52uBfM7RSuGPhUXeJfkhzH8EV0BVH2Whw3oT3UeaJMwRZ1OuVddtdGQ8lWui6tAH0cGV2YTg==}
  '@fedify/fedify@1.7.0-pr.251.886':
    resolution: {integrity: sha512-Lvbcnv9uIICU84o7ugKoenMhjbRt82/7eikFiu2kEHQl/Qp12mjHHJAWENpwxJJJiUTEut54bmOMxXVNwr9yLw==}
    engines: {bun: '>=1.1.0', deno: '>=2.0.0', node: '>=22.0.0'}

  '@hongminhee/suite@0.6.3':
    resolution: {integrity: sha512-jW0scPczSP5Mksq49c9stYIApHGijodCFvpKRcFAWImn5WRs4kVlzNwz9QpblaAvoErN8UsfP7OZl3mIk0VoLA==}

  '@hugoalh/http-header-link@1.0.3':
    resolution: {integrity: sha512-x4jzzKSzZQY115H/GxUWaAHzT5eqLXt99uSKY7+0O/h3XrV248+CkZA7cA274QahXzWkGQYYug/AF6QUkTnLEw==}
    engines: {node: '>=16.13.0'}
@@ -538,8 +538,6 @@ packages:

snapshots:

  '@alinea/suite@0.6.2': {}

  '@babel/generator@7.27.5':
    dependencies:
      '@babel/parser': 7.27.5
@@ -589,7 +587,7 @@ snapshots:

  '@fastify/busboy@2.1.1': {}

  '@fedify/fedify@1.6.1(web-streams-polyfill@3.3.3)':
  '@fedify/fedify@1.7.0-pr.251.886(web-streams-polyfill@3.3.3)':
    dependencies:
      '@cfworker/json-schema': 4.1.1
      '@es-toolkit/es-toolkit': es-toolkit@1.39.3
@@ -613,6 +611,8 @@ snapshots:
    transitivePeerDependencies:
      - web-streams-polyfill

  '@hongminhee/suite@0.6.3': {}

  '@hugoalh/http-header-link@1.0.3':
    dependencies:
      '@hugoalh/is-string-singleline': 1.0.5
Loading