/** * Executes example. * * @param args Command line arguments, none required. */ public static void main(String[] args) { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(); System.out.println(">>> Cache star schema example started."); CacheConfiguration<Integer, FactPurchase> factCacheCfg = new CacheConfiguration<>(PARTITIONED_CACHE_NAME); factCacheCfg.setCacheMode(CacheMode.PARTITIONED); factCacheCfg.setIndexedTypes(Integer.class, FactPurchase.class); CacheConfiguration<Integer, Object> dimCacheCfg = new CacheConfiguration<>(REPLICATED_CACHE_NAME); dimCacheCfg.setCacheMode(CacheMode.REPLICATED); dimCacheCfg.setIndexedTypes( Integer.class, DimStore.class, Integer.class, DimProduct.class); try (IgniteCache<Integer, FactPurchase> factCache = ignite.getOrCreateCache(factCacheCfg); IgniteCache<Integer, Object> dimCache = ignite.getOrCreateCache(dimCacheCfg)) { populateDimensions(dimCache); populateFacts(factCache); queryStorePurchases(); queryProductPurchases(); } } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); c.setDiscoverySpi(disco); CacheConfiguration<?, ?> cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setBackups(1); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setIndexedTypes(Integer.class, Integer.class); c.setCacheConfiguration(cc); return c; }