Toggle infinispan caches for dev or testing env - infinispan

I moved from EhCache to Infinispan and I have requirement that be able to toggle caches (not only globally but also for specific cache name).
Using EhCache there was a option setDisable(Boolean) to disable a cache.
I would like to achieve something similar with Infinispan, however I don't want to change my app code. I mean I don't want something like
if cache is enabled
...
else
...
I'm waiting to something that NoOp cache operation, like calling put(key, object) do nothing at all (not only storing, but no serialization, no computation) and same for others methods.
Since I'm using Spring integration I was thinking about using CompositeCacheManager with NoOpCacheManager fallback but current existing Spring integration uses dynamic cache creation, so getCache(String) never returns null (thus NoOpCacheManager is never used).

Set the property infinispan.embedded.cache.enabled to false

Related

How to keep GraphQL API and frontend synchronized on a staging server?

We have a Rails application with GraphQL API in one GIT repository, and React frontend application in another. Both backend and frontend have CI and are deployed separately. But both backend and frontend are still under heavy development and often our staging server doesn't work, because deployment is not synchronized and we don't test the whole application - we test API and we test frontend without API.
What is the best way to deploy frontend and backend only when they are synchronized, I mean when new versions doesn't break functionalities? I thought about third repository with backend and frontend included as GIT modules, acceptance tests and deploying both sides at once. But maybe there is simpler solution? Maybe some versioning?
You certainly can do versioning with GraphQL, but ideally any changes to your schema shouldn't be breaking ones. This just takes discipline on the part of your backend devs, although there are also tools (like this) to help detect breaking changes. Some general guidelines:
Deprecate fields using the #deprecated directive instead of deleting them. Deprecated fields can be communicated to client teams and retired after some agreed-upon amount of time.
Avoid renaming types. Try to use more specific naming to avoid having to rename things in the future (i.e. use emailMessage instead of just message if you could foreseeably have a different kind of message in the future).
Use payload types for mutations. If you mutate a User, for example, instead of just returning the User, return a payload type that has a user field. If down the road, you realize the mutation should also return other information, you can easily add fields to the payload type without creating breaking changes.

How can I change another dataSource (not default c3p0) in Play 1.4.3

In Play 1.4.3, the default pool is c3p0. I wanna change it.
Something like follows:
db=java:/comp/env/jdbc/myDatasource#
db=jndi:jdbc/myDataSource
how can I config to make it work?
Changing the pool would effectively mean changing the framework code itself, since it's "bundled" with Play.
One way to do this is to clone Play from GitHub (https://github.com/playframework/play1) so you can make whatever low-level changes you like.
Alternatively, you could look at the 1.5.x releases, which use HikariCP as the connection pool out of the box.

Geode region[key] get triggers region listener create event

Using Geode 1.2 and 9.1 Pivotal native client the following code:
IRegion<string, IPdxInstance> r = cache.GetRegion<string, IPdxInstance>("myRegion");
return r[key];
then triggers an AfterCreate event for myRegion. Why does that happen when no data is created, only read?
Same here, never used Native Client. I agreed with what #Urizen suspected - you are calling r[key] from an instance of Geode that doesn't have the entry, so it pulls the data from other instance, which "create" the entry locally.
You have a few options here:
Performing an interest registration for the instance you are initiating the call using registerAllKeys() (doc here). There is a catch here: (might not be applicable for native client), in Java API, you have an option to register interest with an InterestResultPolicy. If you use KEYS_VALUES, you will load all data to local from remote on startup WITHOUT triggering afterCreate callback. If you choose KEYS only or NONE, you will likely have similar problem.
You can check for boolean flag remoteOrigin in EntryEvent. If it is false, it is purely local. In a non-WAN setup, this should be enough to distinguish your local operation from remotely initiated operation (be it a cache syncing or a genuine creation initiated by other cache). Vaguely remembering WAN works a bit different here.
I've never used the Native Client but, at a first glance, it should be expected for the afterCreate event to be invoked on the client side as the entry is actually being created on the local cache. What I mean is that the entry might exists on the server but, internally, the client needs to retrieve it from the server, and then create it locally (thus invoking the afterCreate for the locally installed CacheListener). Makes sense?.

weblogic - controlling the thread count of a web app

I'd like to control how many threads can be used by a web application.
So far I thought it can be set by creating an application-scope workmanager (Deployments -> [application] -> Configuration -> Workload) and setting the Maximum Thread Constraint.
However recently I have the feeling that it is not true as this workmanager should be referenced from the code so it has to be used explicitly from the application.
What I'd need is to configure that from now on the XYZ application can use max 5 threads but no more. It can be done on global level but I want to control only one application.
As far as I know, if you define the workmanager in app's weblogic.xml or weblogic-application.xml, it's for sure will work on application level instead of config.xml which is domain-level config.
If you create and configurate the workmanager's max-threads-constraint and then reference to it in your app’s web.xml file like this:
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>your_workmanager_name</param-value>
</init-param>
i'm pretty sure, that this constraint will apply only on certain app's level.
I have the feeling that it is not true as this workmanager should be referenced from the code so it has to be used explicitly from the application.
Where'd you find this? I may be wrong but I never heard or read that it should be referenced explicitly from code instead of xml.
For more details take a look on this and this in case you hadn't.

Worklight - Updatable static content

I have this requirement : My WL application have a set of static pages that might be updated any time. Originally the source of all static content is a desktop page that will be transformed by xsl to a mobile friendly content. The problem that I don't want to do that on each request (HA requirement).
I want to get some inspiration on how to architect that without using direct update mechanism (don't want the end user to get notified of these updates).
I should note that pages will change rarely every few month maybe.
I'm thinking about 2 ways of doing that :
1- Making the transformation on adapter side and rely on WL caching so that transformation is not made each time (does that exist ?). But how the adapter will get notified of page change and flush the cache ? Should I program some advanced java based adapter ? (Storing in the cache and having a kind of a job that scans every day for content changes ?)
2- Doing it mobile side but I don't know how to get notified of changes !
Is your only problem with Worklight's Direct Update that the user is being notified and is required to explicitly approve the transfer?
In this case why not use the option of Silent Direct Update?
The property you're looking for is updateSliently set to true in initOptions.js.
For this to work it is required, obviously, that connectOnStartup will be set to true as well.
perhaps what is doable is to use an adapter to fetch the HTML (or whatever it is) and save it to the device's local storage and then have the app display this content, this way you do not alter the app's web resources and not trigger Direct Update.