-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no matching event handler defined in the remote service. Event pattern: undefined error message #11
Comments
Hi, could you provide pubsub message example which client sends? |
@p-fedyukovich Sure message example
here is my topic schema
p.s I tried with this lib and it's working fine https://github.com/crallen/nestjs-google-pubsub#readme |
Your message data format is wrong because it should have metadata for correct selecting message handler. If you use your own message dispatcher it should produce message in such format {
"pattern": "notifications",
"eventId": "any string value for that message which keeps idemopotency",
"data": "Your message payload"
} |
Thank you for reply. |
I provided the message structure, you should update your message producer to fit the message structure |
Hi @p-fedyukovich I have trouble publishing the message, could you please provide a working example here or to the ReadMe file? |
Hi, there are examples in test files. import {
Body,
Controller,
HttpCode,
OnApplicationShutdown,
Post,
Query,
} from '@nestjs/common';
import {
ClientProxy,
EventPattern,
MessagePattern,
} from '@nestjs/microservices';
import { GCPubSubClient } from '../../lib';
@Controller()
export class GCPubSubController implements OnApplicationShutdown {
client: ClientProxy;
constructor() {
this.client = new GCPubSubClient({
client: {
apiEndpoint: 'localhost:8681',
projectId: 'microservice',
},
});
}
onApplicationShutdown(signal?: string) {
return this.client.close();
}
@Post('notify')
async sendNotification(): Promise<any> {
return this.client.emit('notification', true);
}
} |
What is apiEndpoint: 'localhost:8681' responsible for, how to use it? |
This is yours |
From the example above, it's not quite clear where I'm creating a microservice with this port. I would be very grateful if you could tell me where I can see a working example of server and client operation. It seems to me that these examples do not quite explain everything |
Hi I tried to use the library but I keep getting "There is no matching event handler defined in the remote service. Event pattern: undefined" error when a new message arrives.
my code is like this.
main.ts
Then in app.controller
nestjs:8.2.5 (I tried with 8.0.0 as well)
@google-cloud/pubsub: 2.19.4
nestjs-google-pubsub-microservice: 2.2.0
The text was updated successfully, but these errors were encountered: