當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultCamelContext.setName方法代碼示例

本文整理匯總了Java中org.apache.camel.impl.DefaultCamelContext.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultCamelContext.setName方法的具體用法?Java DefaultCamelContext.setName怎麽用?Java DefaultCamelContext.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.camel.impl.DefaultCamelContext的用法示例。


在下文中一共展示了DefaultCamelContext.setName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCamelContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
public void addCamelContext(String name, boolean start, boolean setActive) throws Exception {
    if (contextMap.get(name) != null) {
        throw new IllegalArgumentException("A context named \"" + name + "\" already exists. If you want " +
                "to replace it, remove it first.");
    }
    LOGGER.info("Adding Camel Context: " + name);
    DefaultCamelContext context = new DefaultCamelContext(registry);
    context.setName(name);
    context.setTracing(trace);
    this.contextMap.put(name, context);
    if (setActive) {
        setActiveContext(name);
    }
    if (start) {
        contextMap.get(name).start();
    }
    listeners.forEach(standaloneListener -> standaloneListener.configure(context));
}
 
開發者ID:Steve973,項目名稱:camel-standalone,代碼行數:19,代碼來源:Standalone.java

示例2: createRouteBuilder

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            DefaultCamelContext dcc = (DefaultCamelContext) context;
            dcc.setName("myCamel");

            context.setStreamCaching(true);
            context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir/#name#/");

            from("direct:start").routeId("foo")
                .convertBodyTo(int.class)
                .to("mock:a");
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:18,代碼來源:ManagedStreamCachingStrategyTest.java

示例3: createRegistry

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();

    // let's create our black box as a Camel context and a set of routes
    DefaultCamelContext blackBox = new DefaultCamelContext(registry);
    blackBox.setName("blackBox");
    blackBox.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // we received purchase orders, so let's process it in some way then
            // send an invoice to our invoice endpoint
            from("direct:purchaseOrder").setHeader("received").constant("true").to("direct:invoice");
        }
    });
    blackBox.start();

    registry.bind("accounts", blackBox);
    return registry;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:JavaDslBlackBoxTest.java

示例4: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?").to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextSuspendResumeTest.java

示例5: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("myCamel");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired one")
                .to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("myCamel");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired two")
                .to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:27,代碼來源:QuartzTwoCamelContextSameNameClashTest.java

示例6: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("myCamel");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired one")
                .to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("myCamel");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?")
                .log("Fired two")
                .to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:27,代碼來源:QuartzTwoCamelContextSameNameClashTest.java

示例7: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?").to("log:two", "mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextRestartTest.java

示例8: testDupeNameMultiContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Test
public void testDupeNameMultiContext() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    QuartzComponent component2 = new QuartzComponent(camel2);
    component2.createEndpoint("quartz://myGroup/myTimerName");
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:QuartzNameCollisionTest.java

示例9: testDupeName

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Test
public void testDupeName() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz2://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    try {
        camel1.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("quartz2://myGroup/myTimerName?cron=0/2+*+*+*+*+?").to("log:two", "mock:two");
            }
        });
        Assert.fail("Should have thrown an exception");
    } catch (FailedToCreateRouteException e) {
        String reason = e.getMessage();
        Assert.assertEquals(reason.indexOf("Trigger key myGroup.myTimerName is already in use") >= 0, true);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:26,代碼來源:QuartzNameCollisionTest.java

示例10: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    camel2.setName("camel-2");
    camel2.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myOtherGroup/myOtherTimerName?cron=0/1+*+*+*+*+?").to("mock:two");
        }
    });
    camel2.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:QuartzTwoCamelContextTest.java

示例11: testNoStatefulCollisionError

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
/**
 * Don't check for a name collision if the job is stateful.
 */
@Test
public void testNoStatefulCollisionError() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?stateful=true&cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();

    camel2 = new DefaultCamelContext();
    QuartzComponent component2 = new QuartzComponent(camel2);

    component2.createEndpoint("quartz://myGroup/myTimerName?stateful=true");
    // if no exception is thrown then this test passed.
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:22,代碼來源:QuartzNameCollisionTest.java

示例12: createCamelContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
private static DefaultCamelContext createCamelContext(String prefix, String name, Registry registry) {
    DefaultCamelContext ctx = createWithRegistry(registry);
    ctx.setName(prefix + name);
    ctx.disableJMX();
    ctx.setStreamCaching(true);
    return ctx;
}
 
開發者ID:drinkwater-io,項目名稱:drinkwater-java,代碼行數:8,代碼來源:CamelContextFactory.java

示例13: createCamelContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = (DefaultCamelContext) super.createCamelContext();

    context.setUseMDCLogging(true);
    context.setName(this.getClass().getSimpleName());

    return context;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:10,代碼來源:MllpTcpClientProducerTest.java

示例14: createCamelContext

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
protected CamelContext createCamelContext(String name, String managementPattern) throws Exception {
    DefaultCamelContext context = new DefaultCamelContext();
    context.setName(name);
    if (managementPattern != null) {
        context.getManagementNameStrategy().setNamePattern(managementPattern);
    }
    return context;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:9,代碼來源:TwoManagedCamelContextClashTest.java

示例15: setUp

import org.apache.camel.impl.DefaultCamelContext; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    camel1 = new DefaultCamelContext();
    camel1.setName("camel-1");
    camel1.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("quartz://myGroup/myTimerName?cron=0/1+*+*+*+*+?").to("log:one", "mock:one");
        }
    });
    camel1.start();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:13,代碼來源:QuartzOneCamelContextRestartTest.java


注:本文中的org.apache.camel.impl.DefaultCamelContext.setName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。