I am trying to test my Spring Integration setup, but am receiving
"MessageDeliveryException: Dispatcher has no subscribers for channel".
I'm using a QueueChannel and I don't think it needs a handler (from what I can see in the docs).
I'm using Spring Integration Java DSL to define the integration flow programmatically, rather than using a context.
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.channel.MessageChannels;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class SimplifiedIntegrationTest {
@Test
public void simpleTest() {
MessageChannel inputChannel = MessageChannels.direct().get();
QueueChannel outputChannel = MessageChannels.queue().get();
IntegrationFlows.from(inputChannel).channel(outputChannel).get();
inputChannel.send(MessageBuilder.withPayload("payload").build());
Message<?> outMessage = outputChannel.receive(0);
Assert.notNull(outMessage);
}
}