Search in sources :

Example 1 with PipelineDefinition

use of org.apache.camel.model.PipelineDefinition in project camel by apache.

the class AdviceWithBuilder method after.

/**
     * Insert the following node(s) <b>after</b> the matched node(s)
     *
     * @return the builder to build the nodes.
     */
public ProcessorDefinition<?> after() {
    RouteDefinition route = builder.getOriginalRoute();
    PipelineDefinition answer = new PipelineDefinition();
    if (id != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.afterById(route, id, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toString != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.afterByToString(route, toString, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toUri != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.afterByToUri(route, toUri, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (type != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.afterByType(route, type, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    }
    return answer;
}
Also used : RouteDefinition(org.apache.camel.model.RouteDefinition) PipelineDefinition(org.apache.camel.model.PipelineDefinition)

Example 2 with PipelineDefinition

use of org.apache.camel.model.PipelineDefinition in project camel by apache.

the class AdviceWithBuilder method replace.

/**
     * Replaces the matched node(s) with the following nodes.
     *
     * @return the builder to build the nodes.
     */
public ProcessorDefinition<?> replace() {
    RouteDefinition route = builder.getOriginalRoute();
    PipelineDefinition answer = new PipelineDefinition();
    if (id != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.replaceById(route, id, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toString != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.replaceByToString(route, toString, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toUri != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.replaceByToUri(route, toUri, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (type != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.replaceByType(route, type, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    }
    return answer;
}
Also used : RouteDefinition(org.apache.camel.model.RouteDefinition) PipelineDefinition(org.apache.camel.model.PipelineDefinition)

Example 3 with PipelineDefinition

use of org.apache.camel.model.PipelineDefinition in project camel by apache.

the class DualPipelineTest method testDualPipeline.

public void testDualPipeline() throws Exception {
    getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
    getMockEndpoint("mock:b").expectedBodiesReceived("After A");
    getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
    getMockEndpoint("mock:d").expectedBodiesReceived("After C");
    getMockEndpoint("mock:e").expectedBodiesReceived("After C");
    getMockEndpoint("mock:result").expectedMessageCount(1);
    template.sendBody("direct:start", "Hello World");
    assertMockEndpointsSatisfied();
    // now check the route
    MulticastDefinition mc = assertIsInstanceOf(MulticastDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(0));
    PipelineDefinition pd1 = assertIsInstanceOf(PipelineDefinition.class, mc.getOutputs().get(0));
    PipelineDefinition pd2 = assertIsInstanceOf(PipelineDefinition.class, mc.getOutputs().get(1));
    assertEquals(3, pd1.getOutputs().size());
    assertEquals(4, pd2.getOutputs().size());
    SendDefinition<?> send1 = assertIsInstanceOf(SendDefinition.class, pd1.getOutputs().get(2));
    assertEquals("mock:b", send1.getUri());
    SendDefinition<?> send2 = assertIsInstanceOf(SendDefinition.class, pd2.getOutputs().get(3));
    assertEquals("mock:e", send2.getUri());
    SendDefinition<?> send = assertIsInstanceOf(SendDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(1));
    assertEquals("mock:result", send.getUri());
}
Also used : MulticastDefinition(org.apache.camel.model.MulticastDefinition) PipelineDefinition(org.apache.camel.model.PipelineDefinition)

Example 4 with PipelineDefinition

use of org.apache.camel.model.PipelineDefinition in project camel by apache.

the class AdviceWithBuilder method before.

/**
     * Insert the following node(s) <b>before</b> the matched node(s)
     *
     * @return the builder to build the nodes.
     */
public ProcessorDefinition<?> before() {
    RouteDefinition route = builder.getOriginalRoute();
    PipelineDefinition answer = new PipelineDefinition();
    if (id != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.beforeById(route, id, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toString != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.beforeByToString(route, toString, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (toUri != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.beforeByToUri(route, toUri, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    } else if (type != null) {
        builder.getAdviceWithTasks().add(AdviceWithTasks.beforeByType(route, type, answer, selectFirst, selectLast, selectFrom, selectTo, maxDeep));
    }
    return answer;
}
Also used : RouteDefinition(org.apache.camel.model.RouteDefinition) PipelineDefinition(org.apache.camel.model.PipelineDefinition)

Aggregations

PipelineDefinition (org.apache.camel.model.PipelineDefinition)4 RouteDefinition (org.apache.camel.model.RouteDefinition)3 MulticastDefinition (org.apache.camel.model.MulticastDefinition)1