-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Karaf Tutorial Part 1 - Is it possible to run tasklist-ui bundle independently from tasklist-persistence bundle? #42
Comments
Currently, I have managed to get it working in the following way:
Is this the usual way to use a bundle from another plugin? (tasklist-persistence -> using tasklist-ui) |
I think you can use an optional service reference in blueprint. This way your servlet also comes up when the service is not present and can then decide what to do. Btw. I just updated the example to the newest version of the blueprint maven plugin and switched to the new annotations. |
Thanks for your response. I have switched over to the newest version of the project and managed to get it working with @reference(availability = Availability.OPTIONAL) annotation. So, it is currently coded that the "task-persistence ui" bundle is an optional service. The call to the "TaskService" method call is now surrounded with a try-catch to handle the ServiceUnavailableException. Is there a better way to handle the detection of the service that unavailable instead of catching the exception? |
Not sure it this is possible with blueprint. In my newer projects I always
use declarative services(DS).
There an optional dependency is simply null if it is not present.
Btw. DS is also a lot more dynamic. It starts your component only if all
mandatory services are available and stops it again when one disappears. So
your bundles are never stuck in graceperiod.
Christian
2018-03-22 12:24 GMT+01:00 Laurent Kleering vb <notifications@github.com>:
… Thanks for your response. I have switched over to the newest version of
the project and managed to get it working with @reference
<https://github.com/reference>(availability = Availability.OPTIONAL)
annotation. So, it is currently coded that the "task-persistence ui" bundle
is an optional service. The call to the "TaskService" method call is now
surrounded with a try-catch to handle the ServiceUnavailableException.
Is there a better way to handle the detection of the service that
unavailable instead of catching the exception?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAdk6IR7H1i61RqEvKBd2KdbEONDY2iMks5tg4oJgaJpZM4S0FBI>
.
--
--
Christian Schneider
http://www.liquid-reality.de
Computer Scientist
http://www.adobe.com
|
Thank for the information, it has given me more understanding of Services & Components. |
Hello, I would like to develop an application using the Apache Karaf container combined with a OSGi based application. I would like to know if it is possible to run the "TaskListServlet.java" that is located in the Tasklist-ui module independently from the TaskService, which is from the tasklist-persistence module. For instance, I want to be able to run the TaskListServlet when the persistence is not available. Instead it would show you a custom page or error message.
I don't know how it would look like, but maybe like initializing the 'taskService" only when the tasklist-persistence is available as bundle.
Thank you in advance.
The text was updated successfully, but these errors were encountered: