Just a quick demo on Hazelcast MapStore and CDC using PostgreSQL. To run the demo:
- Set the license key
export HZ_LICENSEKEY=$(cat ~/hazelcast/demo.license)
- Start three Hazelcast and Postgres
docker-compose up -d
We will use auto mapping of Postgres table dashboard
and Hazelcast map dashboard
and use the GenericMapStore
to cache and write-through data to Postgres.
- We used GenericMapStore to cache and write-through (default behaviour) data to postgres.
- In such cases Hazelcast will create mapping on its own as documented here. Note the mapping that gets created is between Hazelcast and Postgres.
- The automatic mapping created by Hazelcast called
__map-store.dashboard
which you can use when using SQL. Basically this is a mapping to the Postgre tabledashboard
and not the hazelcast mapdashboard
. - Take note of the
map
nameddashboard
in filehazelcast.yaml
. For any need to modify the default configuration take note of the choices available here. - We have configured
dashboard
map to load eagerly but it loads only when the map is called for the first time. You can do that via theClient
class or using Hazelcast CLC and executeclc -c dev map -n dashboard key-set
While the section above created a cache with low code but in order to query the cache in Java you can use Compact Seriraliation to query the cache. See CompactClient