Code Monkey home page Code Monkey logo

pubsub's People

Contributors

afzaalahmad avatar bendakh avatar ccoeurderoy avatar dependabot-preview[bot] avatar dependabot[bot] avatar g-ongenae avatar gitsambhal avatar leker29 avatar meriambensassi avatar na-ji avatar qhdinh avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pubsub's Issues

event name used to create topic and subscription

Hello,
I noticed that the following method uses the same event string to get or create both the topic and the subscription. For this is impossible to create a topic with a different name than the subscription. Does it really make sense to use the same string for both? Shouldnt we be able to have different names for subscription and topic?

public async listen<T>(
event: string,
opts: ListenOptions<T, GCListenOptions> = { options: { autoAck: true } },
): Promise<void> {
const topic: Topic = await this.getOrCreateTopic(event, opts.options?.topicOptions);
const subscription: Subscription = await this.getOrCreateSubscription(
event,
topic,
opts.options?.subscriptionOptions,
);
this.logger.debug(`Listened to topic ${topic.name} with subscription ${subscription.name}`);

Google never acknowledge that the event has been received and send it again and again.

Hi, we found out a small bug. We have a NestJs micro-services with a couple of @EventPattern('my_event').

Until now it was working perfectly, we do a data.ack() at the end of the function. We also setup the dealLetter queue that after 5 not ack we send it to the deadLetter.

The thing is that it was working until we had 19 @EventPattern('my_event').
When we included more (20 and beyond), it seems like google pub/sub doesn't even acknowledge that the events have been received (all the events were affected).

We tried to console log the getOriginalMessage().deliveryAttempt and it doesn't increase even though event id is the same.
We still get the event, we still can ack it, there is no error... but pub/sub still resend the event again and again on the server restart.

And if we keep the number of @EventPattern('my_event') below 20 then it works fine again.

Do you know why? if there is a solution to be able to go over this limit ?

Thanks

autoAck: false not supported

Hi,

thanks for this awesome package!

I want to set autoAck to false to ensure successful processing but then I cannot ack the message anymore since the EmittedMessages does not holds the original .ack() method anymore.

Best
Philipp

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Tests are failing locally

npm test

As you can see, 3 tests failed and I had to kill the process after about two minutes.

Capture d’écran 2021-03-10 à 11 27 47

Tests are working in the CI environment, but it does not work locally...

Originally posted by @g-ongenae in #133 (comment)

how to close the connection to stop listening for new messages?

Hi guys,

I am using pubsub.client.close() method to close the connection to the pubsub but the subscription(created using pubsub.listen) is not closed and the messages are received even after closing it.
What is the proper way to close the listening on subsription?

A way to pass subscription options/metadata

Greetings!

I've been playing around with your NestJS implementation with pubsub and it works really well. I'm looking for a way to set subscription options, such as ackDeadlineSeconds and deadLetterPolicy. Is there a way to do it with the current implementation? I'm having some trouble finding how to achieve this.
edit: I just digged through the code and it seems the subscriptions are made with autoCreate, I believe you can't pass these options in this case :( anyway I'd like to ask if you have any idea how I can make a workaround, appreciate it!

How to set orderingKey in Nestjs ?

I want to receive message from subscription one at a time (example: next msg should come only after previous one is acked/expired for same orderKey ) based on same orderingKeys and concurrently with different.

Upgrade to @google-cloud/pubsub 3.5.1

There is a possible fix for this error (see here):

2023-04-24 07:04:25 | Node.js v19.8.1
2023-04-24 07:04:25 | }
2023-04-24 07:04:25 | errorCode: 'INVALID'
2023-04-24 07:04:25 | at async ModAckQueue.flush (/usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:195:29) {
2023-04-24 07:04:25 | at async ModAckQueue._sendBatch (/usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:476:31)
2023-04-24 07:04:25 | at async Promise.all (index 0)
2023-04-24 07:04:25 | at /usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:470:43
2023-04-24 07:04:25 | at ModAckQueue.handleAckFailures (/usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:328:18)
2023-04-24 07:04:25 | at Array.forEach (<anonymous>)
2023-04-24 07:04:25 | at /usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:330:29
2023-04-24 07:04:25 | AckError: INVALID : 3 INVALID_ARGUMENT: Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed.
2023-04-24 07:04:25 |  
2023-04-24 07:04:25 | ^
2023-04-24 07:04:25 | const exc = new subscriber_1.AckError(e[0], rpcError.message);
2023-04-24 07:04:25 | /usr/src/app/silver/node_modules/@google-cloud/pubsub/build/src/message-queues.js:330

It is blocking the event loop

I am using Google Pubsub in NestJs and when the data is recieved by the handler, the event loop gets blocked and I am unable to make any HTTP request to the API.
I am using Blocked At plugin to get the following stacktrace.

Blocked for 20320.787875ms, operation started here: [
  '    at AsyncHook.init (/Users/username/myproject/node_modules/.pnpm/[email protected]/node_modules/blocked-at/index.js:31:11)',
  '    at emitInitNative (node:internal/async_hooks:202:43)',
  '    at emitInitScript (node:internal/async_hooks:505:3)',
  '    at promiseInitHook (node:internal/async_hooks:324:3)',
  '    at promiseInitHookWithDestroyTracking (node:internal/async_hooks:328:3)',
  '    at /Users/username/myproject/node_modules/.pnpm/@[email protected]_3xexfhuxzzpm44flufjnppzrlu/node_modules/@nestjs/microservices/context/rpc-context-creator.js:43:23',
  '    at InterceptorsConsumer.intercept (/Users/username/myproject/node_modules/.pnpm/@[email protected]_kj7rymkcr5lkprk6tswpsa5dxa/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:11:20)',
  '    at /Users/username/myproject/node_modules/.pnpm/@[email protected]_3xexfhuxzzpm44flufjnppzrlu/node_modules/@nestjs/microservices/context/rpc-context-creator.js:51:46',
  '    at /Users/username/myproject/node_modules/.pnpm/@[email protected]_3xexfhuxzzpm44flufjnppzrlu/node_modules/@nestjs/microservices/context/rpc-proxy.js:11:38',
  '    at eventHandler (/Users/username/myproject/node_modules/.pnpm/@[email protected]_3xexfhuxzzpm44flufjnppzrlu/node_modules/@nestjs/microservices/listeners-controller.js:55:53)',
  '    at Object.onMessage (/Users/username/myproject/node_modules/.pnpm/@[email protected]_o2upt3vfiv5amp3ncoauuaj7la/node_modules/@algoan/nestjs-google-pubsub-microservice/src/GooglePubSubServer.ts:110:13)',
  '    at Subscription.<anonymous> (/Users/username/myproject/node_modules/.pnpm/@[email protected]/node_modules/@algoan/pubsub/dist/src/GoogleCloudPubSub/GoogleCloudPubSub.js:33:22)',
  '    at Subscription.emit (node:events:513:28)',
  '    at Subscriber.<anonymous> (/Users/username/myproject/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/pubsub/src/subscription.ts:329:38)',
  '    at Subscriber.emit (node:events:513:28)',
  '    at /Users/username/myproject/node_modules/.pnpm/@[email protected]/node_modules/@google-cloud/pubsub/src/lease-manager.ts:243:47',
  '    at processTicksAndRejections (node:internal/process/task_queues:77:11)'
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.