com.hazelcast.jet.config.JetConfig Java Examples

The following examples show how to use com.hazelcast.jet.config.JetConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HazelcastJetServerConfiguration.java    From hazelcast-jet-contrib with Apache License 2.0 6 votes vote down vote up
@Bean
JetInstance jetInstance(HazelcastJetServerProperty serverProperty,
                        HazelcastJetIMDGProperty imdgProperty) throws IOException {
    Resource serverConfigLocation = serverProperty.resolveConfigLocation();
    Resource imdgConfigLocation = imdgProperty.resolveConfigLocation();

    JetConfig jetConfig = serverConfigLocation != null ? getJetConfig(serverConfigLocation)
            : ConfigProvider.locateAndGetJetConfig();
    if (imdgConfigLocation != null) {
        jetConfig.setHazelcastConfig(getIMDGConfig(imdgConfigLocation));
    }

    injectSpringManagedContext(jetConfig.getHazelcastConfig());

    return Jet.newJetInstance(jetConfig);
}
 
Example #2
Source File: JetBetMain.java    From hazelcast-jet-demos with Apache License 2.0 6 votes vote down vote up
private void init() throws IOException, URISyntaxException {
    final JetConfig config = new JetConfig();
    jet = Jet.newJetInstance(config);
    pipeline = buildPipeline();

    // Initialize the domain object factories
    final HazelcastInstance client = jet.getHazelcastInstance();
    CentralFactory.setHorses(HazelcastHorseFactory.getInstance(client));
    CentralFactory.setRaces(new HazelcastFactory<>(client, Race.class));
    CentralFactory.setEvents(new HazelcastFactory<>(client, Event.class));
    CentralFactory.setUsers(new HazelcastFactory<>(client, User.class));
    CentralFactory.setBets(new HazelcastFactory<>(client, Bet.class));

    loadHistoricalRaces();
    createRandomUsers();
    createFutureEvent();
}
 
Example #3
Source File: HazelcastJetServerConfiguration.java    From hazelcast-jet-contrib with Apache License 2.0 5 votes vote down vote up
private static JetConfig getJetConfig(Resource configLocation) throws IOException {
    URL configUrl = configLocation.getURL();
    String configFileName = configUrl.getPath();
    InputStream inputStream = configUrl.openStream();
    if (configFileName.endsWith(".yaml") || configFileName.endsWith("yml")) {
        return new YamlJetConfigBuilder(inputStream).build();
    }
    return new XmlJetConfigBuilder(inputStream).build();
}
 
Example #4
Source File: HazelcastJetAutoConfigurationClientTests.java    From hazelcast-jet-contrib with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() {
    JetConfig jetConfig = new JetConfig();
    jetConfig.configureHazelcast(hzConfig -> hzConfig
            .setClusterName("boot-starter")
            .getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false)
    );
    jetServer = Jet.newJetInstance(jetConfig);
}
 
Example #5
Source File: HazelcastJetAutoConfigurationServerTests.java    From hazelcast-jet-contrib with Apache License 2.0 5 votes vote down vote up
@Test
public void defaultConfigFile() {
    // hazelcast-jet.yaml and hazelcast.yaml present in root classpath
    contextRunner.run((context) -> {
        JetConfig jetConfig = context.getBean(JetInstance.class).getConfig();
        EdgeConfig defaultEdgeConfig = jetConfig.getDefaultEdgeConfig();
        Config hazelcastConfig = jetConfig.getHazelcastConfig();
        assertThat(defaultEdgeConfig.getQueueSize()).isEqualTo(2048);
        assertThat(hazelcastConfig.getClusterName()).isEqualTo("default-cluster");
    });
}
 
Example #6
Source File: HazelcastJetAutoConfigurationServerTests.java    From hazelcast-jet-contrib with Apache License 2.0 5 votes vote down vote up
@Bean
JetConfig anotherHazelcastJetConfig() {
    JetConfig jetConfig = new JetConfig();
    jetConfig.getHazelcastConfig().getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    jetConfig.setProperty("foo", "bar-configAsBean");
    jetConfig.getHazelcastConfig().setClusterName("configAsBean-cluster");
    return jetConfig;
}
 
Example #7
Source File: TestJetRunner.java    From beam with Apache License 2.0 5 votes vote down vote up
private static Collection<JetInstance> initMemberInstances(
    JetTestInstanceFactory internalFactory) {
  JetConfig config =
      new JetConfig()
          .configureHazelcast(
              c ->
                  c.addMapConfig(
                      new MapConfig("map")
                          .setEventJournalConfig(new EventJournalConfig().setEnabled(true))));

  return Arrays.asList(internalFactory.newMember(config), internalFactory.newMember(config));
}
 
Example #8
Source File: HazelcastJetServerConfiguration.java    From hazelcast-jet-contrib with Apache License 2.0 4 votes vote down vote up
@Bean
JetInstance jetInstance(JetConfig jetConfig) {
    return Jet.newJetInstance(jetConfig);
}
 
Example #9
Source File: HazelcastJetAutoConfigurationServerTests.java    From hazelcast-jet-contrib with Apache License 2.0 4 votes vote down vote up
private static ContextConsumer<AssertableApplicationContext> assertSpecificJetServer(String suffix) {
    return context -> {
        JetConfig jetConfig = context.getBean(JetInstance.class).getConfig();
        assertThat(jetConfig.getProperties().getProperty("foo")).isEqualTo("bar-" + suffix);
    };
}
 
Example #10
Source File: HazelcastJetAutoConfigurationServerTests.java    From hazelcast-jet-contrib with Apache License 2.0 4 votes vote down vote up
private static ContextConsumer<AssertableApplicationContext> assertSpecificJetImdgServer(String clusterName) {
    return context -> {
        JetConfig jetConfig = context.getBean(JetInstance.class).getConfig();
        assertThat(jetConfig.getHazelcastConfig().getClusterName()).isEqualTo(clusterName);
    };
}
 
Example #11
Source File: ApplicationConfig.java    From hazelcast-jet-demos with Apache License 2.0 4 votes vote down vote up
@Bean
public JetInstance jetInstance(Config config) {
    JetConfig jetConfig = new JetConfig().setHazelcastConfig(config);
    return Jet.newJetInstance(jetConfig);
}
 
Example #12
Source File: ApplicationConfig.java    From hazelcast-jet-demos with Apache License 2.0 4 votes vote down vote up
@Bean
public JetInstance jetInstance(Config config) {
    JetConfig jetConfig = new JetConfig().setHazelcastConfig(config);
    return Jet.newJetInstance(jetConfig);
}
 
Example #13
Source File: ApplicationConfig.java    From hazelcast-jet-demos with Apache License 2.0 4 votes vote down vote up
@Bean
public JetInstance jetInstance(Config config) {
    JetConfig jetConfig = new JetConfig().setHazelcastConfig(config);
    return Jet.newJetInstance(jetConfig);
}