org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy Java Examples

The following examples show how to use org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy. 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: Application.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Bean(name = "verifier-context", initMethod = "start", destroyMethod = "stop")
public static CamelContext verifierContext() {
    CamelContext context = new DefaultCamelContext();
    context.setNameStrategy(new ExplicitCamelContextNameStrategy("verifier-context"));
    context.disableJMX();

    return context;
}
 
Example #2
Source File: JmsRouteBuilder.java    From wildfly-camel-examples with Apache License 2.0 5 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-jms-context"));

    /**
     * This route generates a random order every 5 seconds
     */
    from("timer:order?period=5s&delay=0")
    .bean("orderGenerator", "generateOrder")
    .setHeader(Exchange.FILE_NAME).method("orderGenerator", "generateFileName")
    .to("file://{{jboss.server.data.dir}}/orders");

    /**
     * This route reads files placed within JBOSS_HOME/standalone/data/orders
     * and places them onto JMS queue 'ordersQueue' within the WildFly
     * internal ActiveMQ Artemis broker.
     */
    from("file://{{jboss.server.data.dir}}/orders")
    .convertBodyTo(String.class)
    // Remove headers to ensure we end up with unique file names being generated in the next route
    .removeHeaders("*")
    .to("jms:queue:OrdersQueue");

    /**
     * This route consumes messages from the 'ordersQueue'. Then, based on the
     * message payload XML content it uses a content based router to output
     * orders into appropriate country directories
     */
    from("jms:queue:OrdersQueue")
        .choice()
            .when(xpath("/order/customer/country = 'UK'"))
                .log("Sending order to the UK")
                .to("file:{{jboss.server.data.dir}}/orders/processed/UK")
            .when(xpath("/order/customer/country = 'US'"))
                .log("Sending order to the US")
                .to("file:{{jboss.server.data.dir}}/orders/processed/US")
            .otherwise()
                .log("Sending order to another country")
                .to("file://{{jboss.server.data.dir}}/orders/processed/Other");
}
 
Example #3
Source File: ActiveMQRouteBuilder.java    From wildfly-camel-examples with Apache License 2.0 5 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-activemq-context"));

    /**
     * This route generates a random order every 5 seconds
     */
    from("timer:order?period=5s&delay=0")
    .bean("orderGenerator", "generateOrder")
    .setHeader(Exchange.FILE_NAME).method("orderGenerator", "generateFileName")
    .to("file://{{jboss.server.data.dir}}/orders");

    /**
     * This route reads files placed within JBOSS_HOME/standalone/data/orders
     * and sends them to ActiveMQ queue 'ordersQueue'
     */
    from("file://{{jboss.server.data.dir}}/orders")
    .convertBodyTo(String.class)
    // Remove headers to ensure we end up with unique file names being generated in the next route
    .removeHeaders("*")
    .to("activemq:queue:OrdersQueue");

    /**
     * This route consumes messages from the 'ordersQueue'. Then, based on the
     * message payload XML content it uses a content based router to output
     * orders into appropriate country directories
     */
    from("activemq:queue:OrdersQueue")
        .choice()
            .when(xpath("/order/customer/country = 'UK'"))
                .log("Sending order to the UK")
                .to("file:{{jboss.server.data.dir}}/orders/processed/UK")
            .when(xpath("/order/customer/country = 'US'"))
                .log("Sending order to the US")
                .to("file:{{jboss.server.data.dir}}/orders/processed/US")
            .otherwise()
                .log("Sending order to another country")
                .to("file://{{jboss.server.data.dir}}/orders/processed/Other");
}
 
Example #4
Source File: MyRouteConfiguration.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Override
public RouteBuilder route() {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("javaConfigContext"));
            from("direct:start").transform(body().prepend("Hello "));
        }
    };
}
 
Example #5
Source File: SecureRouteBuilder.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("secured-context"));
    from("direct:start")
    .policy(new DomainAuthorizationPolicy().roles("Role2"))
    .transform(body().prepend("Hello "));
}
 
Example #6
Source File: HealthRouteBuilder.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("health-context"));

    from("direct:start")
        .to("log:end");
}
 
Example #7
Source File: NameCustomizer.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(CamelContext camelContexty) {
    camelContexty.adapt(ModelCamelContext.class).setNameStrategy(new ExplicitCamelContextNameStrategy(name));
}
 
Example #8
Source File: MailCdiRouteBuilder.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-mail-cdi-context"));
    from("direct:start").to("smtp://localhost:10025?session=#mailSession");
    from("pop3://user2@localhost:10110?delay=30000&session=#mailSession&delete=true").to("mock:result");
}
 
Example #9
Source File: CDIRouteBuilder.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("camel-sql-cdi-context"));
    from("sql:select name from information_schema.users?dataSource=wildFlyExampleDS")
    .to("seda:end");
}
 
Example #10
Source File: SimpleRouteBuilder.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void configure() throws Exception {
    getContext().setNameStrategy(new ExplicitCamelContextNameStrategy("simple-camel-context"));
    from("direct:start").bean("helloBean");
}