Search in sources :

Example 1 with MyAsyncComponent

use of org.apache.camel.component.sjms.support.MyAsyncComponent in project camel by apache.

the class AsyncTopicProducerTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            context.addComponent("async", new MyAsyncComponent());
            from("direct:start").to("mock:before").to("log:before").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    beforeThreadName = Thread.currentThread().getName();
                }
            }).to("async:bye:camel").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    afterThreadName = Thread.currentThread().getName();
                }
            }).to("sjms:topic:foo?synchronous=false");
            from("sjms:topic:foo").to("mock:after").to("log:after").delay(1000).process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    route += "B";
                    sedaThreadName = Thread.currentThread().getName();
                }
            }).to("mock:result");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) MyAsyncComponent(org.apache.camel.component.sjms.support.MyAsyncComponent)

Example 2 with MyAsyncComponent

use of org.apache.camel.component.sjms.support.MyAsyncComponent in project camel by apache.

the class AsyncConsumerFalseTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    camelContext.addComponent("async", new MyAsyncComponent());
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) MyAsyncComponent(org.apache.camel.component.sjms.support.MyAsyncComponent) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 3 with MyAsyncComponent

use of org.apache.camel.component.sjms.support.MyAsyncComponent in project camel by apache.

the class AsyncConsumerInOutTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    camelContext.addComponent("async", new MyAsyncComponent());
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
    SjmsComponent component = new SjmsComponent();
    component.setConnectionFactory(connectionFactory);
    camelContext.addComponent("sjms", component);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) MyAsyncComponent(org.apache.camel.component.sjms.support.MyAsyncComponent) SjmsComponent(org.apache.camel.component.sjms.SjmsComponent)

Example 4 with MyAsyncComponent

use of org.apache.camel.component.sjms.support.MyAsyncComponent in project camel by apache.

the class AsyncQueueProducerTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            context.addComponent("async", new MyAsyncComponent());
            from("direct:start").to("mock:before").to("log:before").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    beforeThreadName = Thread.currentThread().getName();
                }
            }).to("async:bye:camel").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    afterThreadName = Thread.currentThread().getName();
                }
            }).to("sjms:queue:foo?synchronous=false");
            from("sjms:queue:foo?synchronous=false").to("mock:after").to("log:after").delay(1000).process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    route += "B";
                    sedaThreadName = Thread.currentThread().getName();
                }
            }).to("mock:result");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) MyAsyncComponent(org.apache.camel.component.sjms.support.MyAsyncComponent)

Aggregations

MyAsyncComponent (org.apache.camel.component.sjms.support.MyAsyncComponent)4 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)2 CamelContext (org.apache.camel.CamelContext)2 Exchange (org.apache.camel.Exchange)2 Processor (org.apache.camel.Processor)2 RouteBuilder (org.apache.camel.builder.RouteBuilder)2 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)2