-
1. Re: Attaching VDBLifeCycleListener to application
rareddy Aug 24, 2012 8:40 AM (in response to anilallewar)Anil,
With out extending the Teiid code you can not add "VDBLifeCycleListener". Also, this is internal api and may change version to version. For this you need to write a listener in the Teiid subsystem and register it with the VDBRespository. Look for examples in the code.
Every VDB when deployed in AS7 it wil be deployed as a service with the name "service.jboss.teiid.vdb.{vdb-name}.{version}", so if you know the name of the vdb, then you can write ServiceListener that listens to the VDB started event, once you receive this event then you can check if it is deployed in "active" state or not.
What are caching based VDB loads? there may be alternative solutions available.
Ramesh..
-
2. Re: Attaching VDBLifeCycleListener to application
anilallewar Aug 27, 2012 2:49 AM (in response to rareddy)Ramesh,
Thanks for the quick feedback!!
We have a data platform that server data across different models and each VDB holds data for 1 model. I don't want to read the list of deployed VDBs every time I want to show what VDBs are available for data and hence would want to cache the list of deployed VDBs(not actually data in the VDB).
We don't know the name of the VDBs in advance as the application intends to make data from any VDB that is hot deployed also available. The VDB will however have a custom property that lets us identify that it needs to be serviced by the application.
If it is possible, can you point me to place in the source code where I can look for the service listener and how I register it with VDBRepository?
-
3. Re: Attaching VDBLifeCycleListener to application
rareddy Aug 27, 2012 10:05 AM (in response to anilallewar)since you are not doing any action other than storing the name of the VDB in the cache, why not just call the "getVDBs" call on the Admin API? It may not any more expensive than you caching and getting a list from there and keeping them in sync.
If you want to see the VDBLifeCycleListener code take look at the VDBService class.
Ramesh..
-
4. Re: Attaching VDBLifeCycleListener to application
anilallewar Aug 27, 2012 10:19 AM (in response to rareddy)We also require information about the model, source, custom properties that we cache. If we have multiple concurrent users, then reading this data for every user thread will add to performance overhead.
-
5. Re: Attaching VDBLifeCycleListener to application
rareddy Aug 27, 2012 10:30 AM (in response to anilallewar)The VDB object returned from the "getVDB" does have all that information you are looking for.
Unless your application is making a remote call to Teiid Server for this information, I do not think this will add/reduce any more performance impact. From kind of caching you want to do, I think your application is in same VM as the Teiid, so you just providing another cache entry on top of the Teiid's. If your app is remote the above scenario does not work anyway.
Ramesh..
-
6. Re: Attaching VDBLifeCycleListener to application
anilallewar Aug 28, 2012 5:10 AM (in response to rareddy)We need to make remote calls even though we are in the same VM. This is because our application uses EclipseLink Dynamic JPA for persistence and in case of local connections, the transaction gets propogated to the Teiid layer but not to the backend system which is accessed through a custom JDBC driver.
I believe this might be a problem with EclipseLink support for JBoss 7.1.1; I had tested Teiid with Hibernate and it seemed to work fine with local connections then. Unfortunately we are stuck with EclipseLink as that is the only ORM framework that provides support for dynamic JPA.
As of now I am going to remove caching and read the VDB info for each call.
-
7. Re: Attaching VDBLifeCycleListener to application
shawkins Aug 28, 2012 8:15 AM (in response to anilallewar)Anil/Ramesh,
It seems like it would be generally useful to allow the installation of custom listeners since we don't have a global vdb table that could have customizable triggers. This could cover for example custom strategies for external materialization initialization. Ramesh were you thinking that the service name mechanism was enough? Is there a way to generalize that to not know the vdb names/versions ahead of time?
Steve
-
8. Re: Attaching VDBLifeCycleListener to application
rareddy Aug 28, 2012 8:29 AM (in response to shawkins)Yes, it should be possible as all the vdb based services have same base name, so they can filtered out to generate an event.
Ramesh..
-
9. Re: Attaching VDBLifeCycleListener to application
anilallewar Aug 28, 2012 8:53 AM (in response to rareddy)So in this scenario are we looking at a JMX based listener or trying to create a mechanism to hook up listner into the Teiid runtime?
-
10. Re: Attaching VDBLifeCycleListener to application
rareddy Aug 29, 2012 10:45 AM (in response to anilallewar)1 of 1 people found this helpfulRemote eventing is something we need to discuss about. JMX is something we have not explicitly supported out of Teiid. This is generally handled by RHQ based monitoring tool under JBoss AS.
Teiid does provide a EventDistributor interface which a user can find it by doing a JNDI lookup under JBoss AS, may be that is the appropriate place to have this.
Anil, can you log a feature request for this here https://issues.jboss.org/browse/TEIID
Ramesh..
-
11. Re: Attaching VDBLifeCycleListener to application
anilallewar Sep 3, 2012 1:38 AM (in response to rareddy)Feature request https://issues.jboss.org/browse/TEIID-2182 created.
-
12. Re: Attaching VDBLifeCycleListener to application
anilallewar Sep 3, 2013 3:18 PM (in response to anilallewar)Feature implemented in Teiid 8.3.
-
13. Re: Attaching VDBLifeCycleListener to application
kchen007 Apr 23, 2014 10:45 AM (in response to anilallewar)Ramesh:
Can you provide an example? from your test program, it create a FakeServer and call server.getEventDistributor().register(); My problem is that I do not know how to get the server object.
thanks
Kevin
-
14. Re: Attaching VDBLifeCycleListener to application
shawkins Apr 23, 2014 2:52 PM (in response to kchen007)Hi Kevin,
When using embedded (which the fakeserver extends) you can just directly call getEventDistributor. In a server environment, you would use a JNDI lookup as shown on Programmatic Control - Teiid 8.8 (draft) - Project Documentation Editor
Steve