private static Config getConfig() { Config config = new Config(); // Add an event journal config for map which has custom capacity of 1000 (default 10_000) // and time to live seconds as 10 seconds (default 0 which means infinite) config.addEventJournalConfig(new EventJournalConfig().setEnabled(true) .setMapName(MAP_NAME) .setCapacity(1000) .setTimeToLiveSeconds(10)); return config; }
@Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setCacheName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } });
@Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setMapName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } });
public static void main(String[] args) { System.setProperty("hazelcast.logging.type", "log4j"); JetConfig config = new JetConfig(); config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig() .setMapName(TRADES_MAP_NAME) .setCapacity(TRADES_PER_SEC * 10)); config.getInstanceConfig().setCooperativeThreadCount( Math.max(1, Runtime.getRuntime().availableProcessors() / 2)); JetInstance jet = Jet.newJetInstance(config); Jet.newJetInstance(config); try { jet.newJob(buildPipeline()); TradeGenerator.generate(NUMBER_OF_TICKERS, jet.getMap(TRADES_MAP_NAME), TRADES_PER_SEC, JOB_DURATION); } finally { Jet.shutdownAll(); } }
public static void main(String[] args) { System.setProperty("hazelcast.logging.type", "log4j"); JetConfig config = new JetConfig(); config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig() .setMapName(TRADES_MAP_NAME)); JetInstance jet = Jet.newJetInstance(config); Jet.newJetInstance(config); try { jet.newJob(buildDag()); TradeGenerator.generate(100, jet.getMap(TRADES_MAP_NAME), TRADES_PER_SECOND, JOB_DURATION); } finally { Jet.shutdownAll(); } }
private static JetConfig getJetConfig() { JetConfig cfg = new JetConfig(); // Add an event journal config for map which has custom capacity of 1000 (default 10_000) // and time to live seconds as 10 seconds (default 0 which means infinite) cfg.getHazelcastConfig() .getMapEventJournalConfig(MAP_NAME) .setEnabled(true) .setCapacity(1000) .setTimeToLiveSeconds(10); return cfg; }
@Override public IdentifiedDataSerializable createNew(Integer arg) { return new EventJournalConfig(); } };
public static void main(String[] args) throws Exception { System.setProperty("hazelcast.logging.type", "log4j"); // Lower operation timeout to speed up job cancellation System.setProperty("hazelcast.operation.call.timeout.millis", "1000"); JetConfig cfg = new JetConfig(); cfg.getHazelcastConfig().getMapEventJournalConfig(TRADES).setEnabled(true); JetInstance jet = Jet.newJetInstance(cfg); Jet.newJetInstance(cfg); new Enrichment(jet).go(); }
/** * Sets the map of map event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the map event journal configuration map to set * @return this config instance */ public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.mapEventJournalConfigs.clear(); this.mapEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setMapName(entry.getKey()); } return this; }
/** * Sets the map of cache event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the cache event journal configuration map to set * @return this config instance */ public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
/** * Returns a read-only map {@link EventJournal} * configuration for the given name. * <p> * The name is matched by pattern to the configuration and by stripping the * partition ID qualifier from the given {@code name}. * If there is no config found by the name, it will return the configuration * with the name {@code default}. * * @param name name of the map event journal config * @return the map event journal configuration * @throws ConfigurationException if ambiguous configurations are found * @see StringPartitioningStrategy#getBaseName(java.lang.String) * @see #setConfigPatternMatcher(ConfigPatternMatcher) * @see #getConfigPatternMatcher() * @see EvictionConfig#setSize(int) */ public EventJournalConfig findMapEventJournalConfig(String name) { name = getBaseName(name); final EventJournalConfig config = lookupByPattern(configPatternMatcher, mapEventJournalConfigs, name); if (config != null) { return config.getAsReadOnly(); } return getMapEventJournalConfig("default").getAsReadOnly(); }
public static void main(String[] args) { System.setProperty("hazelcast.logging.type", "log4j"); JetConfig config = new JetConfig(); config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig() .setMapName(TRADES_MAP_NAME) .setCapacity(TRADES_PER_SEC * 10)); JetInstance jet = Jet.newJetInstance(config); new TradingVolumeGui(jet.getMap(VOLUME_MAP_NAME)); Jet.newJetInstance(config); try { jet.newJob(buildPipeline()); TradeGenerator.generate(NUMBER_OF_TICKERS, jet.getMap(TRADES_MAP_NAME), TRADES_PER_SEC); } finally { Jet.shutdownAll(); } } }
public static void main(String[] args) { System.setProperty("hazelcast.logging.type", "log4j"); JetConfig config = new JetConfig(); config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig() .setMapName(TRADES_MAP_NAME)); JetInstance jet = Jet.newJetInstance(config); Jet.newJetInstance(config); try { jet.newJob(buildDag()); TradeGenerator.generate(100, jet.getMap(TRADES_MAP_NAME), TRADES_PER_SECOND, JOB_DURATION); } finally { Jet.shutdownAll(); } }
private static JetConfig getJetConfig() { JetConfig cfg = new JetConfig(); cfg.getHazelcastConfig().addCacheConfig(new CacheSimpleConfig().setName(CACHE_NAME)); // Add an event journal config for cache which has custom capacity of 1000 (default 10_000) // and time to live seconds as 10 seconds (default 0 which means infinite) cfg.getHazelcastConfig() .getCacheEventJournalConfig(CACHE_NAME) .setEnabled(true) .setCapacity(1000) .setTimeToLiveSeconds(10); return cfg; }
@Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setMapName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } });
@Override public IdentifiedDataSerializable createNew(Integer arg) { return new EventJournalConfig(); } };
public static void main(String[] args) throws Exception { System.setProperty("hazelcast.logging.type", "log4j"); // All IMap partitions must receive updates for the watermark to advance // correctly. Since we use just a handful of keys in this sample, we set a // low partition count. System.setProperty("hazelcast.partition.count", "1"); JetConfig cfg = new JetConfig(); cfg.getHazelcastConfig().getMapEventJournalConfig("*").setEnabled(true); JetInstance jet = Jet.newJetInstance(cfg); ProducerTask producer = new ProducerTask(jet); try { // uncomment one of these // Pipeline p = aggregate(); // Pipeline p = groupAndAggregate(); Pipeline p = coGroup(); // Pipeline p = coGroupWithBuilder(); System.out.println("Running pipeline " + p); Job job = jet.newJob(p); Thread.sleep(5000); producer.stop(); job.cancel(); } finally { producer.stop(); Jet.shutdownAll(); } }
/** * Sets the map of map event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the map event journal configuration map to set * @return this config instance */ public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.mapEventJournalConfigs.clear(); this.mapEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setMapName(entry.getKey()); } return this; }
/** * Sets the map of cache event journal configurations, mapped by config name. * The config name may be a pattern with which the configuration will be * obtained in the future. * * @param eventJournalConfigs the cache event journal configuration map to set * @return this config instance */ public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) { this.cacheEventJournalConfigs.clear(); this.cacheEventJournalConfigs.putAll(eventJournalConfigs); for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) { entry.getValue().setCacheName(entry.getKey()); } return this; }
/** * Returns a read-only map {@link EventJournal} * configuration for the given name. * <p> * The name is matched by pattern to the configuration and by stripping the * partition ID qualifier from the given {@code name}. * If there is no config found by the name, it will return the configuration * with the name {@code default}. * * @param name name of the map event journal config * @return the map event journal configuration * @throws ConfigurationException if ambiguous configurations are found * @see StringPartitioningStrategy#getBaseName(java.lang.String) * @see #setConfigPatternMatcher(ConfigPatternMatcher) * @see #getConfigPatternMatcher() * @see EvictionConfig#setSize(int) */ public EventJournalConfig findMapEventJournalConfig(String name) { name = getBaseName(name); final EventJournalConfig config = lookupByPattern(configPatternMatcher, mapEventJournalConfigs, name); if (config != null) { return config.getAsReadOnly(); } return getMapEventJournalConfig("default").getAsReadOnly(); }