当前位置: 首页>>代码示例>>Java>>正文


Java Main.bind方法代码示例

本文整理汇总了Java中org.apache.camel.main.Main.bind方法的典型用法代码示例。如果您正苦于以下问题:Java Main.bind方法的具体用法?Java Main.bind怎么用?Java Main.bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.main.Main的用法示例。


在下文中一共展示了Main.bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.camel.main.Main; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    this.host = System.getProperty("pgjdbc.test.server", "localhost");
    this.port = System.getProperty("pgjdbc.test.port", "5432");
    this.database = System.getProperty("pgjdbc.test.db", "event_tests");
    this.user = System.getProperty("pgjdbc.test.user", "dphillips");
    this.password = System.getProperty("pgjdbc.test.password");

    ds = new PGDataSource();
    ds.setHost(this.host);
    ds.setPort(Integer.parseInt(this.port));
    ds.setDatabase(this.database);
    ds.setUser(this.user);
    if (this.password != null) {
        ds.setPassword(this.password);
    }

    main = new Main();
    main.bind("test", ds);
    main.addRouteBuilder(buildConsumer());
    main.addRouteBuilder(buildProducer());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:IntegrationTest.java

示例2: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot(String[] args) throws Exception {
    // create and embed the hazelcast server
    // (you can use the hazelcast client if you want to connect to external hazelcast server)
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();

    main = new Main();
    main.bind("hz", hz);

    if (args.length == 0) {
        // route which uses get/put operations
        main.addRouteBuilder(new CounterRoute("Foo", 8080));
    } else {
        // route which uses atomic counter
        main.addRouteBuilder(new AtomicCounterRoute("Foo", 8080));
    }
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:18,代码来源:ServerFoo.java

示例3: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot(String[] args) throws Exception {
    // create and embed the hazelcast server
    // (you can use the hazelcast client if you want to connect to external hazelcast server)
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();

    main = new Main();
    main.bind("hz", hz);

    if (args.length == 0) {
        // route which uses get/put operations
        main.addRouteBuilder(new CounterRoute("Bar", 9090));
    } else {
        // route which uses atomic counter
        main.addRouteBuilder(new AtomicCounterRoute("Bar", 9090));
    }
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:18,代码来源:ServerBar.java

示例4: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // create jcache component and configure it
    JCacheComponent jcache = new JCacheComponent();
    // use infinispan
    jcache.setCachingProvider(JCachingProvider.class.getName());
    // load infinispan client (hotrod) configuration from the classpath
    jcache.setConfigurationUri("hotrod-client.properties");

    // register the component to Camel with the name jcache
    main.bind("jcache", jcache);

    main.addRouteBuilder(new CounterRoute("Foo", 8888));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:17,代码来源:ServerFoo.java

示例5: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // create jcache component and configure it
    JCacheComponent jcache = new JCacheComponent();
    // use infinispan
    jcache.setCachingProvider(JCachingProvider.class.getName());
    // load infinispan client (hotrod) configuration from the classpath
    jcache.setConfigurationUri("hotrod-client.properties");

    // register the component to Camel with the name jcache
    main.bind("jcache", jcache);

    // route which uses get/put operations
    main.addRouteBuilder(new CounterRoute("Bar", 8889));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:18,代码来源:ServerBar.java

示例6: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    // create and embed the hazelcast server
    // (you can use the hazelcast client if you want to connect to external hazelcast server)
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();

    // setup the hazelcast route policy
    HazelcastRoutePolicy routePolicy = new HazelcastRoutePolicy(hz);
    // the lock names must be same in the foo and bar server
    routePolicy.setLockMapName("myLock");
    routePolicy.setLockKey("myLockKey");
    routePolicy.setLockValue("myLockValue");
    // attempt to grab lock every 5th second
    routePolicy.setTryLockTimeout(5, TimeUnit.SECONDS);

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Foo", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:22,代码来源:ServerFoo.java

示例7: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    // create and embed the hazelcast server
    // (you can use the hazelcast client if you want to connect to external hazelcast server)
    HazelcastInstance hz = Hazelcast.newHazelcastInstance();

    // setup the hazelcast route policy
    HazelcastRoutePolicy routePolicy = new HazelcastRoutePolicy(hz);
    // the lock names must be same in the foo and bar server
    routePolicy.setLockMapName("myLock");
    routePolicy.setLockKey("myLockKey");
    routePolicy.setLockValue("myLockValue");
    // attempt to grab lock every 5th second
    routePolicy.setTryLockTimeout(5, TimeUnit.SECONDS);

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Bar", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:22,代码来源:ServerBar.java

示例8: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    // setup the hazelcast route policy
    ConsulRoutePolicy routePolicy = new ConsulRoutePolicy();
    // the service names must be same in the foo and bar server
    routePolicy.setServiceName("myLock");
    routePolicy.setTtl(5);

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Foo", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:15,代码来源:ServerFoo.java

示例9: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    // setup the hazelcast route policy
    ConsulRoutePolicy routePolicy = new ConsulRoutePolicy();
    // the service names must be same in the foo and bar server
    routePolicy.setServiceName("myLock");
    routePolicy.setTtl(5);

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Bar", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:15,代码来源:ServerBar.java

示例10: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    Properties props = new Properties();
    // list of urls for the infinispan server
    // as we run in domain node we have two servers out of the box, and can therefore include both
    // that the client can load balance/failover to be highly available
    props.setProperty("infinispan.client.hotrod.server_list", "localhost:11222;localhost:11372");
    // by default, previously existing values for java.util.Map operations
    // are not returned for remote caches but they are required for the route
    // policy to work.
    props.setProperty("infinispan.client.hotrod.force_return_values", "true");

    // create remote infinispan cache manager and start it
    RemoteCacheManager remote = new RemoteCacheManager(
        new ConfigurationBuilder().withProperties(props).build(),
        true
    );

    // setup Camel infinispan configuration to use the remote cache manager
    InfinispanConfiguration ic = new InfinispanConfiguration();
    ic.setCacheContainer(remote);

    // setup the hazelcast route policy
    InfinispanRoutePolicy routePolicy = new InfinispanRoutePolicy(ic);
    // the lock names must be same in the foo and bar server
    routePolicy.setLockMapName("myLock");
    routePolicy.setLockKey("myLockKey");
    // the lock value identifies the node
    routePolicy.setLockValue("foo");

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Foo", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:37,代码来源:ServerFoo.java

示例11: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    Properties props = new Properties();
    // list of urls for the infinispan server
    // as we run in domain node we have two servers out of the box, and can therefore include both
    // that the client can load balance/failover to be highly available
    props.setProperty("infinispan.client.hotrod.server_list", "localhost:11222;localhost:11372");
    // by default, previously existing values for java.util.Map operations
    // are not returned for remote caches but they are required for the route
    // policy to work.
    props.setProperty("infinispan.client.hotrod.force_return_values", "true");

    // create remote infinispan cache manager and start it
    RemoteCacheManager remote = new RemoteCacheManager(
        new ConfigurationBuilder().withProperties(props).build(),
        true
    );

    // setup Camel infinispan configuration to use the remote cache manager
    InfinispanConfiguration ic = new InfinispanConfiguration();
    ic.setCacheContainer(remote);

    // setup the hazelcast route policy
    InfinispanRoutePolicy routePolicy = new InfinispanRoutePolicy(ic);
    // the lock names must be same in the foo and bar server
    routePolicy.setLockMapName("myLock");
    routePolicy.setLockKey("myLockKey");
    // the lock value identifies the node
    routePolicy.setLockValue("bar");

    main = new Main();
    // bind the hazelcast route policy to the name myPolicy which we refer to from the route
    main.bind("myPolicy", routePolicy);
    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Bar", 100));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:37,代码来源:ServerBar.java

示例12: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // setup quartz component
    QuartzComponent quartz = new QuartzComponent();
    quartz.setPropertiesFile("quartz.properties");

    // add the component to Camel
    main.bind("quartz2", quartz);

    main.addRouteBuilder(new QuartzRoute("Foo"));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:14,代码来源:ServerFoo.java

示例13: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // setup quartz component
    QuartzComponent quartz = new QuartzComponent();
    quartz.setPropertiesFile("quartz.properties");

    // add the component to Camel
    main.bind("quartz2", quartz);

    // route which uses get/put operations
    main.addRouteBuilder(new QuartzRoute("Bar"));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:15,代码来源:ServerBar.java

示例14: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // the default zookeeper url is localhost:2181
    MasterRoutePolicy master = new MasterRoutePolicy();
    master.setZooKeeperUrl("localhost:2181");
    master.setGroupName("myGroup");
    main.bind("zookeeper-master-policy", master);

    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Foo", 200));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:14,代码来源:ServerFoo.java

示例15: boot

import org.apache.camel.main.Main; //导入方法依赖的package包/类
public void boot() throws Exception {
    main = new Main();

    // the default zookeeper url is localhost:2181
    MasterRoutePolicy master = new MasterRoutePolicy();
    master.setZooKeeperUrl("localhost:2181");
    master.setGroupName("myGroup");
    main.bind("zookeeper-master-policy", master);

    // add the route and and let the route be named Bar and use a little delay when processing the files
    main.addRouteBuilder(new FileConsumerRoute("Bar", 200));
    main.run();
}
 
开发者ID:camelinaction,项目名称:camelinaction2,代码行数:14,代码来源:ServerBar.java


注:本文中的org.apache.camel.main.Main.bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。