|
|
Re: Plugin for data monitoring [message #1725728 is a reply to message #1725660] |
Mon, 07 March 2016 10:26 |
Francois Aissaoui Messages: 38 Registered: April 2015 |
Member |
|
|
Hello Matej,
In my point of view, you have multiple options to perform this operation.
The first one, as you pointed out, is making subscriptions on every container you are interested in and make your own computation in your plugin (push to another database as you mentioned). But this can be hard to make as, depending on your installation and deployment, you can have a lot of applications/containers and you have to create a lot of subscriptions.
Then, talking about the duration, the subscription is not that slow to be sent and is good enough for your intent. (it can be slow if you have a lot of subscriptions, depends on your configuration)
Another possibility, if you are brave enough to look at the ContentInstanceController in the core plugin, is to add directly a call to your plugin at the end of the creation of a ContentInstance (Threaded call of course to let the response of the request to be sent back). In that case, your plugin will be directly called and you will not have to make subscriptions.
Furthermore, you will have to use the ServiceTracker to find your plugin (you have some example in the platform, you just have to look at Activator classes).
The main concern in that case is that you have to change a part of code in the core plugin of the platform. This can be annoying to maintain as this is the main plugin that we change and update (for bug fix, enhancement, etc).
So the choice is yours but still, I would advise the first one which is more maintainable in my point of view.
Hope this can help,
François
|
|
|
|
Re: Plugin for data monitoring [message #1725883 is a reply to message #1725804] |
Tue, 08 March 2016 09:36 |
Francois Aissaoui Messages: 38 Registered: April 2015 |
Member |
|
|
As you said, the notification routine is started before the commit in the database. It does not really mean that the data is not yet in the database because EclipseLink provides a cache so the information can (maybe) be retrieved already.
Another point is that the notification mechanism is threaded, so the call to the notifier just start the thread and goes back to the Controller.
For your concern, you will have to create a new Service in your plugin that will implement an Interface that you will have to provide. So yes, you will have to use the ServiceTracker in the core Activator class to retrieve your service.
You will be able to store your service wherever you want (static way in ContentInstance controller for instance). Just remind to remove the reference in the "removedService" method on the ServiceTracker.
And then, when a ContentInstance is created, you will have to call your plugin using the reference you stored in the ContentInstance class.
Regards,
François
[Updated on: Tue, 08 March 2016 09:37] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03899 seconds