Search in sources :

Example 1 with MessageProducerSupport

use of org.springframework.integration.endpoint.MessageProducerSupport in project spring-integration by spring-projects.

the class IntegrationGraphServer method producers.

private void producers(Collection<IntegrationNode> nodes, Collection<LinkNode> links, Map<String, MessageChannelNode> channelNodes) {
    Map<String, MessageProducerSupport> producers = this.applicationContext.getBeansOfType(MessageProducerSupport.class);
    for (Entry<String, MessageProducerSupport> entry : producers.entrySet()) {
        MessageProducerSupport producer = entry.getValue();
        MessageProducerNode producerNode = this.nodeFactory.producerNode(entry.getKey(), producer);
        nodes.add(producerNode);
        producerLink(links, channelNodes, producerNode);
    }
}
Also used : MessageProducerSupport(org.springframework.integration.endpoint.MessageProducerSupport)

Example 2 with MessageProducerSupport

use of org.springframework.integration.endpoint.MessageProducerSupport 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)

Example 3 with MessageProducerSupport

use of org.springframework.integration.endpoint.MessageProducerSupport in project spring-integration by spring-projects.

the class ManualFlowTests method testWithAnonymousMessageProducerStart.

@Test
public void testWithAnonymousMessageProducerStart() {
    final AtomicBoolean started = new AtomicBoolean();
    MessageProducerSupport producer = new MessageProducerSupport() {

        @Override
        protected void doStart() {
            started.set(true);
            super.doStart();
        }
    };
    QueueChannel channel = new QueueChannel();
    IntegrationFlow flow = IntegrationFlows.from(producer).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) IntegrationFlow(org.springframework.integration.dsl.IntegrationFlow) StandardIntegrationFlow(org.springframework.integration.dsl.StandardIntegrationFlow) Test(org.junit.Test)

Aggregations

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