Sandared / flow-osgi-example

Some examples on how the integration of OSGi and Vaadin Flow is intended to be used
0 stars 1 forks source link

Cannot open e1 or e2 #1

Closed Maurice-Betzel closed 5 years ago

Maurice-Betzel commented 5 years ago

I think I am missing something here. I can log into the Felix webconsole, the events get published but I cannot view the Vaadin pages. What does the URL look like for opening e1 and 2 routes?

Sandared commented 5 years ago

Hi Maurice,

those examples are not working because they were only meant as a showcase on how a Future Integration of OSGi and Vaadin Flow might Look like. See https://github.com/vaadin/base-starter-flow-osgi/issues/25

Kind regards, Thomas

Maurice-Betzel commented 5 years ago

Quick response Thomas, but what a show-stopper. Any other way for Vaadin 13 to get married with the OSGi context. I managed to get this done with 8 by extending Vaadin Servlet and UI classes. Maybe any tipps?

Maurice-Betzel commented 5 years ago

What I see is that Vaadin elements get registered by there “HasElement” interface on the OSGi registry so Vaadin can resolve them there?

Sandared commented 5 years ago

There is a lot going on at the moment regarding Vaadin Flow-OSGi integration, but unfortunatly it is much harder than back in the good old V8 days as Vaadin Flow relies heavily on ServletContainerInitializer which has no direct corresponding counterpart in OSGi (aside from rewriting the whole logic with a BundleTracker)

Right now I would recommend to get started with their OSGi Starter: https://github.com/vaadin/base-starter-flow-osgi so that you have an application that is runnable in an OSGi container and use ServiceTracker to get the services you need in the UI.

For a real well working integration we either have to wait for them to come up with a solution that works or we have to invest a lot of time ourselves ;)

If you want to get involved you might want to have a look at (or an upvote for) the following issues:

I think the guys at Vaadin are thankful for any comment that might help them to work out a solution, as they said they are not that experienced with OSGi yet.

Sandared commented 5 years ago

Hi Maurice,

maybe another possibility to get this up and running is to combine Vaadin Flow with CDI and the CDI integration for OSGi. Maybe @rotty3000 can help you with this topic .

It's just a guess from my side, but maybe this is a workable solution.

Kind regards, Thomas

rotty3000 commented 5 years ago

For the record, OSGi CDI Integration is not by me. It's an OSGi spec which I lead, sure, but many others involved. And the impl has lots of input from also many others. Also the impl is Apache Aries. But I appreciate the shout out.

Sandared commented 5 years ago

I noticed that the moment I hit the "Comment" button and changed it ;) But probably you got the email notficiation with the wording from my first draft of the comment.

Sorry for that.

Sandared commented 5 years ago

@rotty3000 what do you think about running Vaadin Flow in OSGi by leveraging the OSGi CDI integration? Do you think it is possible from what Vaadin explains about their CDI integration here: https://vaadin.com/docs/v13/flow/cdi/tutorial-cdi-basic.html

Although I'm currently trying to understand how the OSGI CDI integration works internally, I don't think I have a good enough big-picture of it to be able to tell if it helps with integrating Vaadin Flow with OSGi or not. So I'm thankful for every insight on this topic by a more experienced person :)

Kind regards, Thomas

rotty3000 commented 5 years ago

I'm not familiar enough with Vaadin to say either way. But I'm willing to take a look. Is this project enough representative of the setup/example of Vaadin Flow?

Sandared commented 5 years ago

Wow! Thanks :) I don't think this project would be the best entry point as it is just a repo to showcase how a future integration of Vaadin and OSGi might look like.

I think a better way to start would be one of the official Vaadin Starters, e.g.,

rotty3000 commented 5 years ago

Ok, I'll see if I can take a look.

Maurice-Betzel commented 5 years ago

Of course CDI, last time I looked at Aries CDI it was in release candidate state. Good point.

Maurice-Betzel commented 5 years ago

Now I remember why I never really used CDI in my projects. It seems to have some impedance mismatch with the OSGi way like, analog to blueprint, using proxies as service references and the lifecycle handling.

rotty3000 commented 5 years ago

Ah, OSGi CDI Integration specification doesn't do that. It uses proper component model like in DS. No proxies.

Maurice-Betzel commented 5 years ago

Cool, it seems I referenced some old specs, any Aries docs available on this topic, besides the official spec?

rotty3000 commented 5 years ago

Not at the moment. Any help with that would be very much appreciated.

Maurice-Betzel commented 5 years ago

I know, 24 hours a day is too short.

Maurice-Betzel commented 5 years ago

@rotty3000 I hope you don’t mind one more question. Since I am a heavy Apache Karaf user I use a lot of the OPS4j PAX libs, which are not always close to the OSGi specs. There exists a PAX-CDI, just released 1.1.0, and in there docs they talk about proxies being used for cross bundle injection. Does this mean Aries CDI is superior in this case, not using proxies?

From the PAX CDI docs:

1.3.3. The Best of Both

The idea of Pax CDI is to break up a monolithic application with a large CDI container into a number of smaller bean bundles, each with its own CDI container. CDI containers from different bundles can interact indirectly through the OSGi service registry.

A bean from bundle A may inject a (proxy of a) bean provided by bundle B, if B has published the bean in the OSGi service registry.

Pax CDI encapsulates OSGi APIs in a portable CDI extension, enabling application developers to publish or consume OSGi services by a handful of annotations.

rotty3000 commented 5 years ago

Instead of trying to explain this here, I'll add a section on architecture to the README :) and then I'll point to it. Once that's done maybe you can offer some suggestions to improve/clarify it. :)

Maurice-Betzel commented 5 years ago

Great stuff, I will set up a POC with my new colleague Braus. Thank you for the quick response.

Sandared commented 5 years ago

Hi Maurice,

If you succeed to setup Vaadin with OSGi CDI then could you notify me on this issue? I would be very interested in such a solution too.

Kind regards, Thomas

Maurice Betzel notifications@github.com schrieb am Mo., 8. Apr. 2019, 07:49:

Great stuff, I will set up a POC with my new colleague Braus. Thank you for the quick response.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Sandared/flow-osgi-example/issues/1#issuecomment-480692570, or mute the thread https://github.com/notifications/unsubscribe-auth/AE00vZHKzrQCBcA2-BJN1GbfPWxMKn3zks5vetiAgaJpZM4cbGP9 .

rotty3000 commented 5 years ago

Sorry I didn't have a chance to try anything yet either. I got too busy trying to write some FAQs ;)

Sandared commented 5 years ago

No problem ;)

Raymond Augé notifications@github.com schrieb am Mo., 8. Apr. 2019, 16:38:

Sorry I didn't have a chance to try anything yet either. I got too busy trying to write some FAQs ;)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Sandared/flow-osgi-example/issues/1#issuecomment-480835370, or mute the thread https://github.com/notifications/unsubscribe-auth/AE00vUvlGWUKxkJzDcZFA0yuNtr8KjGiks5ve0ZbgaJpZM4cbGP9 .

Maurice-Betzel commented 5 years ago

@Sandared , i will keep you posted and put the POC on my GitHub. My colleague and i did not succeed into looking up a distributed OSGi service (Karaf Cellar) using Frameworkutils in a OSGi DS Vaadin Route scoped bean. So CDI has moved up the priority ladder.

Maurice-Betzel commented 5 years ago

To my regret i have to report that we will be using the OSGi service-tracker for managing OSGi registered services and will not be using CDI. The main reason is that the Vaadin CDI is a work in progress and thus would be adding one more source of impedance mismatch. My employer is in the Customs business in Europe, having to deal with the Brexit escapades and therefore we have little room for experiments at this time in history. Keeping Vaadin as close to OSGi as possible, with less moving parts, gives us the best ROI, since our application cluster and knowlledge is based on OSGi.

Sandared commented 5 years ago

Hi Maurice,

that's sad to hear :/

Nevertheless, if you could provide some examples on how you then use Vaadin Flow and OSGi in combination, that would be great :)

@rotty3000 did you find some spare time to have a look at an OSGi CDI Vaadin Flow setup?

Kind regards, Thomas