问题标签 [spring-dsl]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1848 浏览

spring-integration - Log Request, Response and Total Time taken by the flow using Java DSL

I am trying to build a flow that starts with a Http.inboundGateway -> Does Several Things like Store the request data to a Database, Does Header Enrichment, Send to AMQP and returns with a Status of the flow (Successful / Failed).

I have a few things I am struggling with and am not able to figure out.

1.) Logging the Request and Response.

I have managed to log the request that the Http.inboundGateway received (See below. Not sure if that is the right way to do it but it works. Please suggest of there is a better way to do it). That said, I am not able to get a hold of the Response message that is sent to the client and also am kind of out of ideas about how to calculate the Transaction time of the flow and log it to the log file. It would be super useful IF there was a way for me to print Statistics after every transactions like "Received : 5, Success : 4, Failed : 1, Average Transaction Time : 250ms ..etc"

2.) How to add log statements to a Spring DSL Flow?

I want to be able to add log statements (For Debugging) to my Integration DSL definitions so I can look at the log file and understand what happened and what went wrong. As of now, I could NOT been able to find a way to do it other than adding ".wireTap" in the middle of the flow as shown in the definition above. Please suggest if there is a better / correct way to do it.

3.) Customizing the Response sent by "Http.inboundGateway".

I could not figureout how to customize the HTTP Response that the Http.inboundGateway sends back to the clients after the flow is finished. How can I do it, or can you point me to documentation where I can read and understand how to do it? I am looking to use Spring DSL.

The same is true for Error responses also. As you can see, I have NOT added an Error Channel to my Http.inboundGateway. So if an error happens now in its current configuration, the client gets a 500 and the full stack trace. How do I get a hold of the error message and be able to buiold a custom response based on the error and send that to the client. Example : Id they sent me XML payload and the XML is malformed, I want to be able to send them a HTTP 400 with some detail in the Response indicating that their Request Data is not well formed.

0 投票
0 回答
639 浏览

loops - 在带有 spring DSL 的骆驼路线中使用嵌套循环是否有任何解决方法?

我需要遍历路线中的项目列表。在该路线内,我再次必须遍历项目列表。我正在使用它,并使用该属性loop了解当前迭代。CamelLoopIndex

这里的问题是,假设外循环有 50 个项目要迭代,而内循环有 3 个项目要迭代。发生的情况是,在外部循环的第一次迭代之后,它直接跳到第四次迭代,因为内部循环将 设置CamelLoopIndex为 2。

我为此做了一个解决方法:

有没有更好的方法来做到这一点?

0 投票
1 回答
164 浏览

spring-integration - Spring 集成 DSL CPU 使用率

我们在我们的应用程序中大量使用 Spring 集成 DSL,目前正在解决高 CPU 使用率问题。查看消耗高 CPU 的线程,注意到 spring 集成调用堆栈太深,超过 500 行。我们的 Spring 集成流程既长又复杂,代表了深层堆栈,但我试图看看这是否可能是导致 CPU 使用率高的潜在原因。任何关于 spring 集成 DSL 如何影响 CPU 的想法都会有所帮助。

谢谢扎弗

0 投票
2 回答
1703 浏览

java - Spring Integration JMS 不关闭

我有一项服务旨在使用 JMS 队列中的消息。这段代码似乎永远不会在关机时退出,并且卡在第 565 行的循环中org.springframework.jms.listener.DefaultMessageListenerContainer

知道它会这样做吗?下面是相关配置:

线程转储会产生大量信息。我相信这是相关的部分。

问题似乎出在这个代码块中。activeInvokerCount 永远不会变为 0,因此它卡在循环中。 org.springframework.jms.listener.DefaultMessageListenerContainer

启用跟踪日志记录在尝试关闭时会显示此信息。一遍又一遍地。

0 投票
1 回答
347 浏览

jasypt - Spring dsl中的Jasypt加密

我正在尝试在属性文件中添加加密,内容未解密

我的 Spring DSL 看起来像:

我的属性.properties

错误消息:java.lang.SecurityException:用户名 [ENC(D0hnlLDZfGPiC6DtU+NKog==)] 或密码无效。

0 投票
1 回答
1059 浏览

apache-camel - 如何在 Spring DSL 中设置相关 ID

如何在 Spring DSL 中设置关联 ID?以下代码不反映 Active MQ 中的相关 ID

试过

0 投票
1 回答
1078 浏览

apache-camel - 使用 Spring DSL 的 Camel 自定义 @Converter 问题

我只想学习自定义转换器并遇到问题。任何帮助深表感谢。Camel 2.17 版和 JBoss Fuse 6.3

在我的 Spring DSL 中

在 META-INF/services/org/apache/camel/TypeConverter

错误信息 :

0 投票
2 回答
105 浏览

java - 为链中的每个处理程序分配不同的错误处理程序

我有一个应用程序指定一个简单的流程,其中需要以特定顺序调用一系列服务来执行某些功能。Spring 集成及其 DSL 似乎适合这种情况。

任何这些单独的服务都允许失败(这些服务是对外部应用程序的调用),此时链应该停止。不仅如此,控制流还需要根据失败的服务重定向到其他地方。换句话说,我需要为每个服务使用不同的错误处理程序。

问题是我很难找到如何做到这一点,如果有人能指出我正确的方向,我将不胜感激。到目前为止,这就是我解决问题的方式:

我一直在寻找如何为每个处理程序设置错误处理程序/通道,但我没有发现任何有用的东西。

我几乎放弃了搜索并开始编写自己的代码(叹气),它看起来像这样:

.nextStep() 的左侧参数是处理程序,而右侧参数是错误处理程序。这非常简单,但我希望它能说明这一点。

尽管所有现实生活中的流程都可以写在一个大类中,但我认为将每个子流程分解为单独的私有方法/类会更方便。非常感谢。

0 投票
1 回答
1009 浏览

apache-camel - Camel Splitter 存储 CamelSplitSize 并在失败时处理行

http://camel.apache.org/splitter.html [1]

从 [1] 链接我看到 CamelSplitSize 将在已完成的 Exchange 上。

我正在学习骆驼,我想知道有没有办法拆分包含 100 行(假设 100 行)的 xml 文件

如果在处理第 50 行时拆分失败,我们需要将 CamelSplitIndex 显示为 50,CamelSplitSize 显示为 100,CamelSplitComplete 显示为 false

我找不到完成此操作的方法,因为链接 [1] 明确指出 CamelSplitSize 将仅存储在已完成的交换中。有什么办法可以做到这一点??

0 投票
1 回答
767 浏览

spring - Spring 集成 - 从 ActiveMQ 到 Kafka

我目前正在尝试编写一个适配器,它将使用来自 ActiveMQ 的消息并将其发布到 Kafka。

我正在考虑使用 spring 集成来集成这两个消息传递系统。

我的问题是我的应用程序不会维护模型的注册表,许多应用程序将使用这些模型将记录发布到 activeMQ。我想接收这些 javax jms 消息并希望执行一些转换,例如将 jmscorrelationId 添加到 kafka 消息中。

此外,另一个要求是仅当 kafka 发送/发布成功时才向活动 mq 发送确认。

可以使用spring集成将ack发送回activemq吗?

spring 集成会是一个不错的选择吗?

请注意,我的技术架构师不赞成使用 Camel/Mule。此外,他不想使用 Kafka Connect,因为我打算使用 Kafka 连接源。

请建议。