Closed dhermanson closed 4 years ago
I don't have any experience with OSGi myself. Ideally it would be configurable where the default behavior remains as-is, but through some kind of configuration it could be disabled. Is that possible somehow?
What if we we would move that class into a separate module that people would have to add as a dependency explicitly? I'm open to PRs for this, as long as there's accompanying documentation for other users what changes they need to make to get the same behavior they have now.
Hi. I've just added a PR (#237) that provides the ability to configure multiple graphql servlets in OSGi.
Note that the impact to existing functionality is that there is no longer a default servlet deployed on startup, but this can be rectified by added an appropriate configuration as part of the boot config.
@benfortuna @dhermanson Because of this issue the servlet is no longer deployed automatically on startup as you've both mentioned. How can this be configured as part of the boot config that you mention here? I'm trying to get it to work in the example but I can't figure out how to make it work.
@oliemansm apologies for delayed response. I'm not too familiar with Karaf (I'm using Apache Sling) but I'll have a look at the example and see if I can provide a configuration to start the default servlet.
ps. If you have the Felix console available you can create a new configuration in configMgr:
And then use httpservice to verify the servlet is registered:
In Apache Sling to create a default graphql servlet on startup I create a factory configuration like this:
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 onOsgiGraphQLHttpServlet
. Actually, I think I might've deletedOsgiGraphQLHttpServlet
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 theOsgiGraphQLHttpServlet
, 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