Giter Site home page Giter Site logo

Comments (4)

altro3 avatar altro3 commented on August 13, 2024

I don't quite understand what your proposal is? What is the benefit of removing the io.micronaut:micronaut-discovery-core library from the dependencies?

In general, if you look at the implementation of the GrpcEmbeddedServer server class, you will see that the only way to remove it is to rewrite GrpcEmbeddedServer.

I want to say that the situation now is this: Micronaut provides you with the default implementation of the GrpcEmbeddedServer server, but no one is stopping you from writing your own implementation without using discovery-core. Add an analogue of GrpcEmbeddedServer and mark it as @primary bean and that’s it, after that everything should work without discovery-core.

But, I think, it is worth adding conditions for GrpcEmbeddedServer, that the default implementation of the server should only use the class io.micronaut.discovery.ServiceInstance

@graemerocher I think it's better to change the conditions for GrpcEmbeddedServer

From this:

@Requires(classes = io.grpc.ServerBuilder.class)

To this:

@Requires(classes = {
    io.grpc.ServerBuilder.class,
    io.micronaut.discovery.ServiceInstance.class
})

@graemerocher WDYT?

from micronaut-grpc.

mcanalesmayo avatar mcanalesmayo commented on August 13, 2024

@altro3 if I understand correctly, Micronaut discovery is an optional feature, meaning that I, as a user, can opt out
However, the current implementation of GrpcEmbeddedServer requires io.micronaut:micronaut-discovery-core runtime dependency or it'll fail on startup. It requires me, as a user, to add it to the runtime dependencies, even tho I don't wanna use discovery at all.

from micronaut-grpc.

altro3 avatar altro3 commented on August 13, 2024

That's right, it's optional. Hmm, it works. you need to write your own implementation of the EmbeddedServer interface without using discovery. It might make sense to add an Alternative default implementation of the server without using discovery, which would be enabled if there is no ServiceInstance.class class in the classpath. And add a condition to GrpcEmbeddedServer for the presence of this class. Then one or another implementation will be enabled, depending on the connected discovery library

from micronaut-grpc.

altro3 avatar altro3 commented on August 13, 2024

Well, looking at the code again, I see 2 solutions:

  1. Implement the ability to start a service without using classes from discovery, but then you will have to duplicate some classes that are in discovery, for example, events that the service is started or stopped. And the benefit of this is not entirely clear.

  2. Change compileOnly to implementation for the io.micronaut:micronaut-discovery-core dependency, because this implementation cannot work without this library.

I'm leaning towards the second solution.

@graemerocher @timyates

from micronaut-grpc.

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.