@zdavison/matador 4.0.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,6 +99,34 @@ describe('RabbitMQTransport', () => {
99
99
  });
100
100
  });
101
101
  });
102
+ describe('single active consumer', () => {
103
+ function createTransport() {
104
+ return new RabbitMQTransport({
105
+ url: 'amqp://localhost:5672',
106
+ connectionName: 'test',
107
+ });
108
+ }
109
+ function buildOptions(transport, queueDef) {
110
+ const topology = TopologyBuilder.create()
111
+ .withNamespace('sac')
112
+ .addQueue(queueDef)
113
+ .build();
114
+ return transport.buildWorkQueueOptions(topology, queueDef);
115
+ }
116
+ it('sets x-single-active-consumer when singleActiveConsumer is true', () => {
117
+ const transport = createTransport();
118
+ const options = buildOptions(transport, {
119
+ name: 'events',
120
+ singleActiveConsumer: true,
121
+ });
122
+ expect(options.arguments['x-single-active-consumer']).toBe(true);
123
+ });
124
+ it('omits x-single-active-consumer by default', () => {
125
+ const transport = createTransport();
126
+ const options = buildOptions(transport, { name: 'events' });
127
+ expect(options.arguments['x-single-active-consumer']).toBeUndefined();
128
+ });
129
+ });
102
130
  describe('dead-letter and retry queue naming under withNaming', () => {
103
131
  // A v1-style naming strategy: a migrating deployment keeps Matador v1's
104
132
  // `matador.{ns}.{queue}` names so DLQ/retry resources stay identifiable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zdavison/matador",
3
- "version": "4.0.3",
3
+ "version": "4.1.0",
4
4
  "description": "A batteries-included event system.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",