@quatrain/queue-gcp 1.1.25 → 1.2.1-pr25.5739
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/dist/GcpPubsubAdapter.d.ts +16 -0
- package/dist/GcpPubsubAdapter.js +16 -0
- package/package.json +6 -3
- package/src/GcpPubsubAdapter.ts +16 -0
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { AbstractQueueAdapter, QueueParameters } from '@quatrain/queue';
|
|
2
|
+
/**
|
|
3
|
+
* Google Cloud Platform Pub/Sub compatible queue adapter interface.
|
|
4
|
+
*/
|
|
2
5
|
export declare class PubSubQueueAdapter extends AbstractQueueAdapter {
|
|
3
6
|
constructor(params: QueueParameters);
|
|
7
|
+
/**
|
|
8
|
+
* Publishes data buffer as a Pub/Sub topic push.
|
|
9
|
+
*
|
|
10
|
+
* @param data - The data payload.
|
|
11
|
+
* @param topic - The GCP Topic identifier.
|
|
12
|
+
* @returns GCP topic tracking message ID.
|
|
13
|
+
*/
|
|
4
14
|
send(data: any, topic: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Hooks onto the onPublish listener system for internal pub/sub logic tracking.
|
|
17
|
+
*
|
|
18
|
+
* @param topic - Destination topic.
|
|
19
|
+
* @returns The GCP listener handler loop.
|
|
20
|
+
*/
|
|
5
21
|
listen(topic: string): any;
|
|
6
22
|
}
|
package/dist/GcpPubsubAdapter.js
CHANGED
|
@@ -13,6 +13,9 @@ exports.PubSubQueueAdapter = void 0;
|
|
|
13
13
|
const core_1 = require("@quatrain/core");
|
|
14
14
|
const queue_1 = require("@quatrain/queue");
|
|
15
15
|
const pubsub_1 = require("@google-cloud/pubsub");
|
|
16
|
+
/**
|
|
17
|
+
* Google Cloud Platform Pub/Sub compatible queue adapter interface.
|
|
18
|
+
*/
|
|
16
19
|
class PubSubQueueAdapter extends queue_1.AbstractQueueAdapter {
|
|
17
20
|
constructor(params) {
|
|
18
21
|
super(params);
|
|
@@ -22,6 +25,13 @@ class PubSubQueueAdapter extends queue_1.AbstractQueueAdapter {
|
|
|
22
25
|
keyFilename,
|
|
23
26
|
});
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Publishes data buffer as a Pub/Sub topic push.
|
|
30
|
+
*
|
|
31
|
+
* @param data - The data payload.
|
|
32
|
+
* @param topic - The GCP Topic identifier.
|
|
33
|
+
* @returns GCP topic tracking message ID.
|
|
34
|
+
*/
|
|
25
35
|
send(data, topic) {
|
|
26
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
37
|
const dataBuffer = Buffer.from(JSON.stringify(data));
|
|
@@ -30,6 +40,12 @@ class PubSubQueueAdapter extends queue_1.AbstractQueueAdapter {
|
|
|
30
40
|
return messageId;
|
|
31
41
|
});
|
|
32
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Hooks onto the onPublish listener system for internal pub/sub logic tracking.
|
|
45
|
+
*
|
|
46
|
+
* @param topic - Destination topic.
|
|
47
|
+
* @returns The GCP listener handler loop.
|
|
48
|
+
*/
|
|
33
49
|
listen(topic) {
|
|
34
50
|
return this._client.topic(topic).onPublish();
|
|
35
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/queue-gcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.2.1-pr25.5739",
|
|
4
4
|
"description": "Queue adapter for Google Cloud Platform PubSub",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,13 +34,16 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google-cloud/pubsub": "^4.7.0",
|
|
37
|
-
"@quatrain/core": "^1.
|
|
38
|
-
"@quatrain/queue": "^1.
|
|
37
|
+
"@quatrain/core": "^1.2.18",
|
|
38
|
+
"@quatrain/queue": "^1.2.3"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test-ci": "jest --runInBand",
|
|
42
42
|
"build": "tsc",
|
|
43
43
|
"wbuild": "tsc --watch",
|
|
44
44
|
"bump-to": "yarn version"
|
|
45
|
+
},
|
|
46
|
+
"typedoc": {
|
|
47
|
+
"entryPoint": "src/index.ts"
|
|
45
48
|
}
|
|
46
49
|
}
|
package/src/GcpPubsubAdapter.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Core } from '@quatrain/core'
|
|
|
2
2
|
import { AbstractQueueAdapter, QueueParameters } from '@quatrain/queue'
|
|
3
3
|
import { PubSub } from '@google-cloud/pubsub'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Google Cloud Platform Pub/Sub compatible queue adapter interface.
|
|
7
|
+
*/
|
|
5
8
|
export class PubSubQueueAdapter extends AbstractQueueAdapter {
|
|
6
9
|
constructor(params: QueueParameters) {
|
|
7
10
|
super(params)
|
|
@@ -13,6 +16,13 @@ export class PubSubQueueAdapter extends AbstractQueueAdapter {
|
|
|
13
16
|
})
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Publishes data buffer as a Pub/Sub topic push.
|
|
21
|
+
*
|
|
22
|
+
* @param data - The data payload.
|
|
23
|
+
* @param topic - The GCP Topic identifier.
|
|
24
|
+
* @returns GCP topic tracking message ID.
|
|
25
|
+
*/
|
|
16
26
|
async send(data: any, topic: string): Promise<string> {
|
|
17
27
|
const dataBuffer = Buffer.from(JSON.stringify(data))
|
|
18
28
|
const messageId = await this._client.topic(topic).publish(dataBuffer)
|
|
@@ -22,6 +32,12 @@ export class PubSubQueueAdapter extends AbstractQueueAdapter {
|
|
|
22
32
|
return messageId
|
|
23
33
|
}
|
|
24
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Hooks onto the onPublish listener system for internal pub/sub logic tracking.
|
|
37
|
+
*
|
|
38
|
+
* @param topic - Destination topic.
|
|
39
|
+
* @returns The GCP listener handler loop.
|
|
40
|
+
*/
|
|
25
41
|
listen(topic: string) {
|
|
26
42
|
return this._client.topic(topic).onPublish()
|
|
27
43
|
}
|