Skip to content

Multiple graphql servlets in OSGi context #218

Closed
@dhermanson

Description

@dhermanson

Hello,

Thank you for this fantastic library. I am using this library in an OSGi runtime, specifically Apache Karaf. I have a use case for which I want to run more than one instance of a graphql servlet. Having a single graphql servlet doesn't fit my needs. So I'm running into a problem where it doesn't make sense for OsgiGraphQLHttpServlet to register itself as an OSGi component.

Now, I'm somewhat new to OSGi. I started using it about 8 months ago. Perhaps there is some way for me to disable that specific component that I'm not aware of. What I've done is fork this repository and essentially remove the @Component annotation on OsgiGraphQLHttpServlet. Actually, I think I might've deleted OsgiGraphQLHttpServlet entirely.

I get that it is very useful for someone to pull in this library and have a working graphql servlet in an OSGi context. But, unless there's an OSGi trick which would allow me to disable the OsgiGraphQLHttpServlet that I'm not aware of yet (please inform me if that's the case), my current approach is to fork this library and remove that file, so I can have multiple graphql servlets.

Now, I understand that the existence of the OsgiGraphQLHttpServlet doesn't prohibit me from creating additional graphql servlets. But I don't really like having it registered as a servlet if it doesn't make sense for my purposes.

Would it be possible to remove the @Component from the OsgiGraphQLHttpServlet, so that it wouldn't be registered by default? I'm just thinking that anyone who is running in an OSGi context would know what they need to do to wire it up properly.

If my needs don't fit with the goals of the project, I understand. I will happily maintain my fork. I just thought I'd express my use case, because I imagine others may be experiencing it as well.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions