@rxdi/graphql-pubsub 0.7.227 → 0.7.229
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.
- package/README.md +46 -38
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -92,48 +92,56 @@ GraphQLPubSubModule.forRoot({
|
|
|
92
92
|
##### Complex example of dead letter queue
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
|
-
import { AMQPSubscribe, PubSubService } from '@rxdi/graphql-pubsub';
|
|
95
|
+
import { AMQPSubscribe, PubSubService, IDeadLetterMessage } from '@rxdi/graphql-pubsub';
|
|
96
96
|
import { Injectable } from '@rxdi/core';
|
|
97
97
|
|
|
98
|
+
export enum ProjectQueues {
|
|
99
|
+
DELETE_PROJECT_QUEUE = 'delete-project-queue-proba',
|
|
100
|
+
}
|
|
101
|
+
|
|
98
102
|
@Injectable()
|
|
99
|
-
class
|
|
103
|
+
export class ProjectDeleteWorker {
|
|
100
104
|
constructor(private pubsub: PubSubService) {}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
105
|
+
|
|
106
|
+
OnInit() {
|
|
107
|
+
setInterval(() => {
|
|
108
|
+
this.pubsub.publish(ProjectQueues.DELETE_PROJECT_QUEUE, {
|
|
109
|
+
projectId: '69443829a33bcd8655e31b17',
|
|
110
|
+
});
|
|
111
|
+
console.log('message-send-to-queue');
|
|
112
|
+
}, 2000);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@AMQPSubscribe({
|
|
116
|
+
queue: ProjectQueues.DELETE_PROJECT_QUEUE,
|
|
117
|
+
config: {
|
|
118
|
+
prefetch: 1,
|
|
119
|
+
globalPrefetch: true,
|
|
120
|
+
strictName: true,
|
|
121
|
+
arguments: {
|
|
122
|
+
'x-dead-letter-exchange': `${ProjectQueues.DELETE_PROJECT_QUEUE}.DLQ`,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
deleteProjectQueue(message) {
|
|
127
|
+
console.log(message);
|
|
128
|
+
throw new Error('something-went-wrong');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@AMQPSubscribe({
|
|
132
|
+
queue: `${ProjectQueues.DELETE_PROJECT_QUEUE}-dlq`,
|
|
133
|
+
config: {
|
|
134
|
+
prefetch: 20,
|
|
135
|
+
globalPrefetch: true,
|
|
136
|
+
strictName: true,
|
|
137
|
+
exchange: `${ProjectQueues.DELETE_PROJECT_QUEUE}.DLQ`,
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
deleteProjectDeadLetterQueue(message: IDeadLetterMessage<{ test: string }>) {
|
|
141
|
+
console.log('DLQ', message.data, message.error.message);
|
|
142
|
+
// Save to Database as audit log
|
|
143
|
+
}
|
|
137
144
|
}
|
|
145
|
+
|
|
138
146
|
```
|
|
139
147
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/graphql-pubsub",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.229",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rxdi/graphql-pubsub"
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/rxdi/graphql-pubsub#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@rxdi/graphql-rabbitmq-subscriptions": "^0.7.
|
|
34
|
-
"@rxdi/rabbitmq-pubsub": "^0.7.
|
|
33
|
+
"@rxdi/graphql-rabbitmq-subscriptions": "^0.7.228",
|
|
34
|
+
"@rxdi/rabbitmq-pubsub": "^0.7.228",
|
|
35
35
|
"subscriptions-transport-ws": "^0.9.19"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@rxdi/core": "^0.7.
|
|
39
|
-
"@rxdi/graphql": "^0.7.
|
|
40
|
-
"@rxdi/hapi": "^0.7.
|
|
38
|
+
"@rxdi/core": "^0.7.228",
|
|
39
|
+
"@rxdi/graphql": "^0.7.228",
|
|
40
|
+
"@rxdi/hapi": "^0.7.228",
|
|
41
41
|
"@types/graphql": "^14.5.0",
|
|
42
42
|
"@types/hapi": "^18.0.4",
|
|
43
43
|
"@types/jest": "^24.0.22",
|