@nestjstools/messaging-google-pubsub-extension 1.3.0 → 1.3.2
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 +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,21 +33,21 @@ yarn add @nestjstools/messaging @nestjstools/messaging-google-pubsub-extension
|
|
|
33
33
|
import { Module } from '@nestjs/common';
|
|
34
34
|
import { MessagingModule } from '@nestjstools/messaging';
|
|
35
35
|
import { SendMessageHandler } from './handlers/send-message.handler';
|
|
36
|
-
import { MessagingGooglePubSubExtensionModule, GooglePubSubChannelConfig } from
|
|
36
|
+
import { MessagingGooglePubSubExtensionModule, GooglePubSubChannelConfig } from '@nestjstools/messaging-google-pubsub-extension';
|
|
37
37
|
|
|
38
38
|
@Module({
|
|
39
39
|
imports: [
|
|
40
|
-
MessagingGooglePubSubExtensionModule, // Importing the
|
|
40
|
+
MessagingGooglePubSubExtensionModule, // Importing the GooglePubSub extension module
|
|
41
41
|
MessagingModule.forRoot({
|
|
42
42
|
buses: [
|
|
43
43
|
{
|
|
44
|
-
name: '
|
|
45
|
-
channels: ['pubsub-
|
|
44
|
+
name: 'message.bus',
|
|
45
|
+
channels: ['pubsub-command'],
|
|
46
46
|
},
|
|
47
47
|
],
|
|
48
48
|
channels: [
|
|
49
49
|
new GooglePubSubChannelConfig({
|
|
50
|
-
name: 'pubsub-
|
|
50
|
+
name: 'pubsub-command',
|
|
51
51
|
enableConsumer: true, // Enable if you want to consume messages
|
|
52
52
|
autoCreate: true, // Auto-create queue if it doesn't exist
|
|
53
53
|
credentials: { // Optional
|
|
@@ -74,12 +74,12 @@ import { IMessageBus, MessageBus, RoutingMessage } from '@nestjstools/messaging'
|
|
|
74
74
|
@Controller()
|
|
75
75
|
export class AppController {
|
|
76
76
|
constructor(
|
|
77
|
-
@MessageBus('
|
|
77
|
+
@MessageBus('message.bus') private pubsubMessageBus: IMessageBus,
|
|
78
78
|
) {}
|
|
79
79
|
|
|
80
80
|
@Get('/pubsub')
|
|
81
81
|
createUser(): string {
|
|
82
|
-
this.pubsubMessageBus.dispatch(new RoutingMessage(new CreateUser('John FROM
|
|
82
|
+
this.pubsubMessageBus.dispatch(new RoutingMessage(new CreateUser('John FROM pubsub'), 'my_app_command.create_user'));
|
|
83
83
|
|
|
84
84
|
return 'Message sent';
|
|
85
85
|
}
|
package/package.json
CHANGED