spring-integration

Global Transaction Handling in Spring Integration

雨燕双飞 提交于 2019-12-11 16:29:49
问题 Its a Spring Integration application.I have a requirement where I need to persist to DB and then post to Queue/Topic. This should be part of a single transaction. I am planning to use the JTATransactionManager. Application Server is Tomcat. Would someone please provide some sample configuration code required for this implementation. 回答1: You need a third party stand-alone XA transaction manager such as Atomikos. Tomcat doesn't have one. You might also consider alternatives to using full-blown

Create Exchange and queues in Qpid broker

会有一股神秘感。 提交于 2019-12-11 16:13:36
问题 Hi I am testing spring integration project using an embedded broker Qpid. But the problem is that HOW CAN i make queues and exchanges in qpid. I thought that rabbit-config.xml would make the queues and exchanges in qpid broker but to no avail. My flow is create queues and exchanges in qpid broker pass messages to them and inbound amqp adapters bounded to these queues would get messages and i can proceed with the test Error : Queue: 'push.customer.arkona.controller.search' not found on

Spring boot integration mail - authorization failed error

与世无争的帅哥 提交于 2019-12-11 16:07:55
问题 Following is my spring configuration bean for pop3 connection, @Bean public IntegrationFlow mailListener() { return IntegrationFlows.from(Mail.pop3InboundAdapter("pop3://sample.test:Sample2test_1@xxx.xx.x.xx/INBOX") .shouldDeleteMessages(true).get(), e -> e.poller(Pollers.fixedRate(5000).maxMessagesPerPoll(1))) .<Message>handle((payload, header) -> logMail(payload)) .get(); } Also double checked the credentials that looks good. Getting the below exception, 2018-06-22 19:27:54.351 ERROR 2092 -

ExpressionEvaluatingRequestHandlerAdvice sends message to both success and fail channel in case of SpelException

*爱你&永不变心* 提交于 2019-12-11 14:57:56
问题 I had asked few doubts in the comments section of this thread. While debugging the application I noticed some possible code errors. Are they bugs or features? In ExpressionEvaluatingRequestHandlerAdvice::evaluateSuccessExp‌​ression , the exception is thrown after AdviceMessage is sent to SuccessChannel . This causes Exception payload in it. Shouldn't the method first throw the exception if there is one? In the same class, propagateOnSuccessEvaluationFailures is 'false' by default which causes

Expression to filter out elements with empty arrays using `jsonPath`

核能气质少年 提交于 2019-12-11 14:40:32
问题 I have a JSON payload of the form: [ {"id": 1, "list": [1], "name":"one"}, {"id": 2, "list": [1,2], "name":"two"}, {"id": 3, "list": [], "name":"three"} ] And I want to filter out the element from the array the contains an empty "list" property. In other words, I want to discard the element with id=3 and process only the first and second element in my example above. Currently, my filter looks like this: <!-- ne == not equals --> <int:filter id="filter" input-channel="in" output-channel="out"

How to avoid flow stopping in case of handler returns null?

我们两清 提交于 2019-12-11 14:29:49
问题 I have following configuration: flow -> flow.handle(myHandler) .filter(p -> { log.warn("FILTER IS INVOKED"); return p != null; } In case if myHandler#handle returns null - filter is not invoked. How could I achieve passing null value to the filter ? 回答1: I came up with workaround: create wrapper over handler return type: class Wrapper { Foo foo; ... } At this case I can do following: flow -> flow.handle(myHandler) .filter(p -> { log.warn("FILTER IS INVOKED"); return p.getFoo() != null; } 来源:

Spring Integration: MessageSource doesn't honor errorChannel header

扶醉桌前 提交于 2019-12-11 14:10:09
问题 I've the following flow: @Resource(name = S3_CLIENT_BEAN) private MessageSource<InputStream> messageSource; public IntegrationFlow fileStreamingFlow() { return IntegrationFlows.from(s3Properties.getFileStreamingInputChannel()) .enrichHeaders(spec -> spec.header(ERROR_CHANNEL, S3_ERROR_CHANNEL, true)) .handle(String.class, (fileName, h) -> { if (messageSource instanceof S3StreamingMessageSource) { S3StreamingMessageSource s3StreamingMessageSource = (S3StreamingMessageSource) messageSource;

Spring-Kafka Integration 1.0.0.RELEASE Issue with Producer

此生再无相见时 提交于 2019-12-11 13:16:57
问题 I am not able to publish message using Spring Kafka Integration, though my Kafka Java Client is working fine. The Java code is running on Windows and Kafka is running on Linux box. KafkaProducerContext<String, String> kafkaProducerContext = new KafkaProducerContext<String, String>(); ProducerMetadata<String, String> producerMetadata = new ProducerMetadata<String, String>("test-cass"); producerMetadata.setValueClassType(String.class); producerMetadata.setKeyClassType(String.class); Encoder

Swagger 2 + spring integration

Deadly 提交于 2019-12-11 12:57:32
问题 I'm trying to expose rest API with Spring Integration and document it with swagger. Is it even possible ? I cannot find any docs or example to make it work. My swagger docket bean: Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); And simple flow: @Bean public IntegrationFlow inbound() { return IntegrationFlows.from(Http.inboundGateway("/foo") .requestMapping(m -> m.methods(HttpMethod.GET)) .requestPayloadType(String.class

Spring ClassPathResource - cannot be opened because it does not exist

浪尽此生 提交于 2019-12-11 12:57:32
问题 UPDATE: I'll still keep Artem Bilan's answer marked as correct, but I still felt I needed to point this out for any future readers. It seems I was misunderstanding the concept of the 'default value' for the @Value annotation. The functionality I was hoping to achieve by using @Value("${someProp:defaultFilePath}") private Resource resourcefilePath; was that, should the file path someProp defined in application.properties throw an exception (i.e. file not found), it would then attempt to use