Giter Site home page Giter Site logo

Comments (6)

joaoandremartins avatar joaoandremartins commented on September 28, 2024

You showed some concerns on the original PR with doing this kind of low level resource manipulation at Spring initialization time. Do you not feel the same way anymore?

from spring-cloud-gcp.

artembilan avatar artembilan commented on September 28, 2024

Well, my point is about distinguishing new Subscriber() and start() if that is possible.
Otherwise I will live with the new instance each time the start() is called.

"level resource manipulation" is a connection to the target service and it really must not happen in the new or in the afterPropertiesSet().
But if Subscriber is robust to stop/start, and is really lightway at the moment of instantiation, we really can move it into the afterPropertiesSet() as one-to-one relationship with enclosing PubSubInboundChannelAdapter.

Does it make sense to you now?

from spring-cloud-gcp.

joaoandremartins avatar joaoandremartins commented on September 28, 2024

Yes, I understood you wanted to cache the Subscribers (and possibly the Publishers too?), but MessageProducerSupport doesn't implement afterPropertiesSet().

I'm thinking of checking if the subscriber already exists on doStart(). If it does and is running, do nothing, if it isn't running, start it, if it doesn't exist, create a new one. I'm testing stopping/starting a Subscriber, but running into some deadlocks. Need to investigate more.

from spring-cloud-gcp.

artembilan avatar artembilan commented on September 28, 2024

Quoting this issue description:

Therefore Subscriber.defaultBuilder() should be done from the onInit().

That onInit() is called from the super.afterPropertiesSet(). No need to fight with the state in the doStart().

from spring-cloud-gcp.

joaoandremartins avatar joaoandremartins commented on September 28, 2024

Starting, then stopping, then starting the same Subscriber doesn't work, since it keeps its internal state and won't restart. I think that's because when Subscriber is closed, it closes all its connections, so there isn't an advantage on restarting the same Subscriber vs just creating a new one.

WDYT @artembilan ?

from spring-cloud-gcp.

artembilan avatar artembilan commented on September 28, 2024

Thank you for the investigation, @joaoandremartins !

Closing since it does not make sense work as designed.

from spring-cloud-gcp.

Related Issues (20)

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.