2
votes

After upgrading the above jar files, I keep running into the issue below:

org.springframework.beans.factory.BeanCreationException: The 'currentComponent' (org.springframework.integration.router.MethodInvokingRouter@5ddcc487) is a one-way 'MessageHandler' and it isn't appropriate to configure 'outputChannel'. This is the end of the integration flow. at org.springframework.integration.dsl.IntegrationFlowDefinition.registerOutputChannelIfCan(IntegrationFlowDefinition.java:3053) at org.springframework.integration.dsl.IntegrationFlowDefinition.register(IntegrationFlowDefinition.java:2994) at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:1167) at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:987) at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:964) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Code Snippet:

public IntegrationFlow inBoundFlow(ConnectionFactory mqConnection)
    throws JMSException {

    return IntegrationFlows
            .from(Jms.messageDrivenChannelAdapter(mqConnection)
                    .configureListenerContainer(listenerContainer)
                    .destination(mqProperties.getQueue().getRequest())
                    .errorChannel(ErrorChannel())
                    .setHeaderMapper(new DefaultJmsHeaderMapper()))
            .filter(filterMessage, "filterMessage", m -> m.discardChannel(DiscardChannel()))
            .route(mqMessageRouter, "messageRouter")
            .handle(errorChannel, "handleError")
            .get();
}


@Named
public class MQErrorMessageChannel {

    @ServiceActivator(inputChannel = MQ_ERROR_MESSAGE_INPUT_CHANNEL, outputChannel = MQ_ERROR_MESSAGE_OUTPUT_CHANNEL)
    public Message<String> handleError(Throwable t) {
//Do Something....
        }
        return null;
    }
}

Any pointer?

1

1 Answers

3
votes

The .route(mqMessageRouter, "messageRouter") in this form of method invocation is exactly one-way and you can't point anything after that in the flow.

There is no strict decision which channel will be next after router, so we can't continue the flow from there.

Just divide your flow to several and add that .handle() there to each particular routed flow.