2
Если я определяю поток интеграции Jms таким образом, есть ли способ избежать литья типа сообщения в обработчике? Или, может быть, я должен реализовать JMS Integration по-другому?Безопасность сообщений в Spring Integration DSL
@EnableJms
@EnableIntegration
@Configuration
public class JmsInboundFlow {
private Logger logger = LoggerFactory.getLogger(JmsInboundFlow.class);
@Autowired
public ConnectionFactory jmsConnectionFactory;
@Autowired
private JmsMessageMyPojoHandlerService handlerService;
@Bean
public IntegrationFlow jmsMessageDrivenFlow() {
return IntegrationFlows.from(messageDrivenChannelAdapter(jmsConnectionFactory).destination("queuName")
.errorChannel(jmsMyPojoErrorChannel()))
.transform(Transformers.fromJson(MyPojo.class))
.handle(message -> handlerService.addEvent((Message<MyPojo>) message))
.get();
}
@Bean
public MessageChannel jmsMyPojoErrorChannel() {
return MessageChannels.direct("customErrorChannel")
.get();
}
@Bean
public IntegrationFlow customErrorFlow() {
return IntegrationFlows.from(jmsMyPojoErrorChannel())
.handle(msg -> logger.error("Error processing JMS message " + msg.getPayload()))
.get();
}
}
кажется, что свободный строитель не безопасен по типу, но я не знаю, почему –