So, for a long time now people have been decrying the death of xactions. In fact – Pedro put the final nail in the coffin with startup actions via PDI.
But! There’s one final bastion of this technology. Mondrian cache.
Now; Before we go too far – yes I know you can do this much better using CDC – Yes, CDC does not REQUIRE a distributed cache, and it does provide an API for clearing cubes as well as a UI. BUT – it’s not uncommon to be in a situation where installing a new plugin is simply not possible.
So, how does it work. Well the thing about xactions is that they are very powerful, and the way they work in the BA platform is actually very clever. Their downfall has little to do with their functionality, and more to do with their usability and distinct lack of documentation! Anyway downfall they have..
So; How to do it? Well there’s documentation here, but it’s not particularly useful:
Better is an example here:
Now; That example does a full on clear of an individual region in the cache, what if you just want to clear an individual cubes cache? Do that like so:
var conn = shared_olap_connection.shareConnection().getConnection(); var cacheControl = conn.getCacheControl(null); cacheControl.flushSchemaCache();
How to find more about the API? Simple! Check the code here.
But; What about the mondrian schema, where does it live in the BA platform? Well there is some really old doco on that here:
But in reality the most useful links you can have are these:
List data sources:
(Obviously replace host and port with your details!)
Download a schema (Assuming you have permissions of course)
List JDBC connections:
And naturally see the details of one of those connections:
It’s also possible to parameterise your xaction so the datasource and schema are parameters, therefore you can call it from the ETL.
The only minor caveat of this approach is you may have a user who has permission to clear the cache – and you use this user when you clear from the ETL. But now; This user will also need Execute permission because they need to execute the xaction which clears the cache. You can still lock down what that user can see however.
Finally, if you want to see what the MDX Connection component in an xaction does, you can read the code here:
I guess if you wanted to redeem yourself and do this in a PDI job instead you’d have to do something similar. (Actually you can define Mondrian datasources in PDI but I couldnt see a way of actually getting the connection in code, in order to flush it.)