Skip to content

Conversation

@johnament
Copy link
Contributor

I'm only marking this as a WIP for now, to make sure this makes sense first. Still need to add some tests and port the existing SSE code to use this.

}

private static void customize(JAXRSServerFactoryBean bean) {
ServiceLoader<JAXRSServerFactoryCustomizationExtension> extensions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be loaded from the bus as other extensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bus.getExtension

main issue is ServiceLoader doesnt work accross environments cxf works so cxf has another "portable" abstraction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're talking about ExtensionRegistry, the javadoc on that indicates OSGi preference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

META-INF/cxf/bus-extensions.txt / Extension (check ExtensionManagerImpl). Thinking about it we already have events on the bus so it can be used to customize the server without requiring any new API or specific kind of SPI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnament That's the thing, right, if you leave it here it should become a public instance method of the JAXRSServerFactoryBean. Than the question would be, it is there but never being called inside JAXRSServerFactoryBean, what the purpose of this method? I think we could always move it back if the use case pops up. Make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes meecrowave uses the extension.

The fact to not use a SPI but a native cxf loading makes the feature generic IMHO. If we dont care about it as a feature then just testing if sse jar is here (loadClass is fine) and set the sse transportid is enough and doesnt require any SPI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmannibucau I'm planning to use this same approach for adding MP OpenTracing support as well; TBD though if that's going to be part of Apache CXF.

@reta the method right now is on ResourceUtils. I was going to pull this out into something like a JAXRSServerFactoryCustomizationUtils, so the question is whether this should sit in the CDI module or the jaxrs-frontend module. Obviously my vote is jaxrs-frontend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnament then ensure there is an OSGi test and it is deactivable through a bus or factory property please (dont think it is in this PR, is it?). Goal is to ensure the code is portable and not limited to MP which would dedeat the SPI and that the module can be provided as a container service but not activated if not desired in the app. Also opentracing is already integrated in brave alone or cxf extension so probably doesnt need much SPI but more a wrapper.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JAXRSServerFactoryCustomizationUtils in jaxrs-frontend sounds good, thanks

@johnament johnament force-pushed the cxf-testing-customization branch from becd594 to 886dcb6 Compare January 20, 2018 15:30
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
Copy link
Member

@reta reta Jan 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree that all was not correct here, but I would like SSE to be discoverable with no efforts when run in CDI container. I think we need only one single class to be discoverable , SseFeature, so @johnament could we add some exclusion / inclusion rules instead of just cutting everything off?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since SseFeature is a core CXF feature, not a JAX-RS feature, I believe its autoloaded that way. Isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is core CXF feature, right, and is it automatically discovered by CDI extension (as an annotated type). But I believe if we set bean-discovery-mode="none", it won't be automatically discovered anymore, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test it out and get back to you. If it doesn't work, I'd actually prefer to move it into the extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up going the route of adding the feature's behavior into the extension. Thoughts?

@johnament johnament force-pushed the cxf-testing-customization branch from 886dcb6 to 89fcf2a Compare February 4, 2018 23:14
@johnament johnament merged commit 0a57060 into apache:master Feb 7, 2018
rmannibucau pushed a commit to rmannibucau/cxf that referenced this pull request Sep 23, 2018
…pache#369)

- Register the existing SSE event handling as an extension
rmannibucau pushed a commit to rmannibucau/cxf that referenced this pull request Mar 18, 2019
…pache#369)

- Register the existing SSE event handling as an extension
rmannibucau pushed a commit to rmannibucau/cxf that referenced this pull request May 31, 2019
…pache#369)

- Register the existing SSE event handling as an extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants