Search in sources :

Example 1 with MessageProducerSpec

use of org.springframework.integration.dsl.MessageProducerSpec in project spring-integration by spring-projects.

the class ManualFlowTests method testWithAnonymousMessageProducerSpecStart.

@Test
public void testWithAnonymousMessageProducerSpecStart() {
    final AtomicBoolean started = new AtomicBoolean();
    class MyProducer extends MessageProducerSupport {

        @Override
        protected void doStart() {
            started.set(true);
            super.doStart();
        }
    }
    class MyProducerSpec extends MessageProducerSpec<MyProducerSpec, MyProducer> {

        MyProducerSpec(MyProducer producer) {
            super(producer);
        }
    }
    MyProducerSpec spec = new MyProducerSpec(new MyProducer());
    QueueChannel channel = new QueueChannel();
    IntegrationFlow flow = IntegrationFlows.from(spec.id("foo")).channel(channel).get();
    this.integrationFlowContext.registration(flow).register();
    assertTrue(started.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) QueueChannel(org.springframework.integration.channel.QueueChannel) MessageProducerSupport(org.springframework.integration.endpoint.MessageProducerSupport) MessageProducerSpec(org.springframework.integration.dsl.MessageProducerSpec) IntegrationFlow(org.springframework.integration.dsl.IntegrationFlow) StandardIntegrationFlow(org.springframework.integration.dsl.StandardIntegrationFlow) Test(org.junit.Test)

Aggregations

AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Test (org.junit.Test)1 QueueChannel (org.springframework.integration.channel.QueueChannel)1 IntegrationFlow (org.springframework.integration.dsl.IntegrationFlow)1 MessageProducerSpec (org.springframework.integration.dsl.MessageProducerSpec)1 StandardIntegrationFlow (org.springframework.integration.dsl.StandardIntegrationFlow)1 MessageProducerSupport (org.springframework.integration.endpoint.MessageProducerSupport)1