java - 如何在 Spring 集成中将两个(对象和列表)发送到转换器
问题描述
入站流.Java
@Bean
public IntegrationFlow SampleFlow(ConnectionFactory jmsListenerConnectionFactory,
MarshallingJmsMessageConverter sampleJmsMessageConverter,
JmsMessageListenerContainerConfigurer jmsMessageListenerContainerConfigurer) {
return IntegrationFlows
.from(Jms
.messageDrivenChannelAdapter(
jmsMessageListenerContainerConfigurer.configure(Jms.container(jmsListenerConnectionFactory,
jmsDestinationsProperties.getName().get("queueName"))).get())
.jmsMessageConverter(sampleJmsMessageConverter)
.errorChannel(errorChannelProperties.getChannel()))
.channel("inbound-channel").get();
}
集成流.Java
@Bean
public IntegrationFlow sampleransformationFlow(LinkagesDataService1 service1,
LinkagesDataService2 service2, aProperties properties) {
return IntegrationFlows.from("inbound-channel")
.transform(Transformers.converter(
new MyConverterClass(service1, service2, properties)))
.channel("outbound-channel").get();
}
入站流.java
@Bean
public IntegrationFlow psampleProducerFlow(ServiceBusClientFactory clientFactory) {
return IntegrationFlows.from("outbound-channel").enrichHeaders(h -> h.headerExpression(
ServiceBusHeaders.SESSION_ID,
"payload.value1 + payload.value2"))
.handle(ServiceBus.outboundChannelAdapter(clientFactory).entityId("SAMPLE")).get();
}
我的问题是:上面的代码正在执行正常流程,没有任何问题。但是在发布输入文件时,如果没有找到特定的字段,那么我们需要为Error POJO类设置errorCode、description等。我已经完成了那部分..现在,我需要知道如何从转换器发送 normalFlow 和 errorFlow ......另外,我需要按原样发送 normalflow,如果找不到字段,那么值也需要是转移到话题。(它实际上没有问题地这样做)。
如果未找到特定字段,则应发生正常流,并且 erroFlow 应捕获 erroCode、Desc 等并需要移动到错误主题。.
现在我有一个 normalFlow 对象,以及同一个转换类中的 errorFlow 列表。如何将这 2 个(对象和列表)返回给转换器。如何在积分中做条件发送 normalFlow,还需要检查列表是否为 =1 />1 。如果是,则将错误 json 移至 TOPIC 或 null。
请帮忙。
解决方案
推荐阅读
- entity-framework-core - 添加具有复杂类型属性的实体
- hadoop - 无法在 oozie 中运行 shell(错误=2,没有这样的文件或目录)
- ios - 无法在 Xcode 中的设备中查看或从 iPad 下载 OTA 应用程序
- python - 替换 csv 标题而不删除其他行
- python-3.x - 使用 Word Embeddings 查找具有更大权重的某些单词的文档之间的相似性
- windows - 在 Windows 上运行 GloVe
- excel - 使用 Office 2007 根据上次填充的单元格动态更改单元格引用
- android - 下载管理器下载应用程序包中的文件
- sphinx - 狮身人面像清除已删除的数据
- c# - 使用 ffmpeg 时如何提高图像导出/提取速度?