如何在Spring集成中向流程发送消息?

问题描述 投票:0回答:1

假设以下流程:

public IntegrationFlow sendFlow() {
        return IntegrationFlow.from(inputChannel())
                .handle("something","someMethod")
                .channel(outputChannel())
                .get();
}

如何手动将消息放入输入通道?

我想要这样的东西:

Message<String> message = MessageBuilder.withPayload("Test).build();
Something.submitToChannel("outputChannel", message);

注意:我从 Web 端点调用此函数。

谢谢

java spring spring-integration message-queue endpoint
1个回答
0
投票

类似:

@Autowire
MessageChannel inputChannel;

...

Message<String> message = MessageBuilder.withPayload("Test").build();
this.inputChannel.send(message);
© www.soinside.com 2019 - 2024. All rights reserved.