有没有人知道使用tcp套接字使用spring集成连接到Web服务器的简单示例?普通java中有简单套接字通信的例子,包括服务器和客户端实例.还有一些在Spring集成中完全将客户端连接到服务器的示例.但是,在我试图通过普通的Java应用程序与spring集成网关建立一个简单的套接字连接时,spring端看到了连接,但是在最大消息长度异常时失败了.到目前为止,我找不到将这两种类型连接在一起的示例.
谢谢
我有一个队列通道,以及一个带有轮询器的服务激活器,它从该队列中读取.我想要配置说"我想要50个线程来轮询该队列,每次轮询并获得一条消息,在这个线程上,调用service-activator指向的服务."
该服务没有@Async注释,但是无状态且可以安全地以并发方式运行.
下面会这样做吗?还有其他首选方法可以实现这一目标吗?
<int:channel id="titles">
<int:queue/>
</int:channel>
<int:service-activator output-channel="resolvedIds" ref="searchService" method="searchOnTitle" input-channel="titles">
<int:poller fixed-delay="100" time-unit="MILLISECONDS" task-executor="taskExecutor"></int:poller>
</int:service-activator>
<task:executor id="taskExecutor" pool-size="50" keep-alive="120" />
Run Code Online (Sandbox Code Playgroud) concurrency spring asynchronous producer-consumer spring-integration
我是Spring Integration的新手.我让ActiveMQ说'responseQ'.所以当消息到达'responseQ' - > painResponseChannel - > transformer - > processResponseChannel - > beanProcessing时.我有以下设置:
<jms:message-driven-channel-adapter extract-payload="true"
channel="painResponseChannel"
connection-factory="connectionFactory"
destination-name="responseQ"/>
<integration:channel id="painResponseChannel" />
<integration-xml:unmarshalling-transformer
id="defaultUnmarshaller"
input-channel="painResponseChannel"
output-channel="processResponseChannel"
unmarshaller="marshaller"/>
<integration:channel id="processResponseChannel" />
<integration:service-activator
input-channel="processResponseChannel"
ref="processResponseActivator"/>
<bean id="processResponseActivator" class="com.messaging.processor.PainResponseProcessor"/>
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.domain.pain.Document</value>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
所以我的问题是我该如何测试结束?如何断言变压器的输出或断言通道上的什么?我尝试但失败了......希望有人可以提供帮助.
提前致谢.GM
我是这样测试的:在我的测试环境中创建了一个出站通道适配器,它使用testJmsQueue通道启动在activeMQ上发送消息.并且还为processResponseChannel - > testChannel创建了一个BRIDGE.我期待receive()方法能给我回馈一些东西.但我认为问题在于它太快了,当它到达receive()方法时,管道已经结束.
测试上下文如下所示:
<integration:bridge input-channel="processResponseChannel" output-channel="testChannel"/>
<jms:outbound-channel-adapter id="jmsOut" destination-name="responseQ" channel="testJmsQueue"/>
<integration:channel id="testJmsQueue"/>
<integration:channel id="testChannel">
<integration:queue/>
</integration:channel>
Run Code Online (Sandbox Code Playgroud)
然后在单元测试中我有这个:
@ContextConfiguration(locations = "classpath*:PainResponseTest-context.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class PainResponseTest {
private String painResponseXML;
@Autowired
MessageChannel …Run Code Online (Sandbox Code Playgroud) 我需要一个自定义适配器来轮询自定义资源.(它返回一个文件列表.)
它是否能够在弹簧集成中实现和使用它?
实施这种可轮询资源的最佳做法是什么?
在此之前因为过于宽泛而关闭:Spring Integration论坛已关闭并引用Stack Overflow(SO).这不是SO的关注,但我很想得到答案......
Mule ESB项目在其网站上解释了它与Spring Integration的区别.但是,关于文档的dcterms.date 2012-07-19T18:43-03:00,文本可能已过时.
引用段落的要点是
这些要点仍然有效吗?是否存在更详细的(如果有的话)最新比较?
Mule ESB与Spring Integration
最近,Spring组件中添加了一个名为Spring Integration的新组件,它允许在Spring Framework中创建和管理类似ESB的功能和EIP.Spring Integration采用所谓的"以应用程序为中心"的集成方法.
Spring Integration旨在通过提供实现框架,为特定应用程序提供"只需一点"ESB风格的集成,而不是实现共享总线,允许集中管理,管理和配置组件和系统之间的所有集成和消息传递.常见的EIP,例如消息总线和简单路由.由于其范围有限,Spring Integration最适合于必须集成少量组件的情况,通常是内部组件,并且所讨论的基础架构由大量其他Spring组件组成.对于任何更复杂的事情,缺少公共总线,再加上可用于年轻项目的极少数支持的传输和变换器,使得Spring Integration不适合这项任务.
使用Mule ESB处理Spring环境中的集成的优点是Mule ESB不仅仅是一个ESB - 它是一个集成平台.尽管Spring Integration的范围仅限于Spring Portfolio环境中的小规模集成,但Mule的有意模块化架构允许团队快速为任何场景提供最轻微的集成解决方案,从简单的点对点集成到复杂的SOA,云和伙伴生态系统方案
我是apache kafka的初学者,并试图学习融合 - kafka - rest - utils,但是我很困惑,我怎么能用它.
在搜索过程中,我发现了这个文档https://spring.io/blog/2015/04/15/using-apache-kafka-for-integration-and-data-processing-pipelines-with-spring
这是非常好的文档,但它并没有帮助我学习rest-utils.
融合kafka rest utils的git代码是
https://github.com/confluentinc/kafka-rest演示了如何使用rest kafka.但我想知道确切的程序,以便更加了解它.用一些简单的解释.任何人都可以建议我与我如何使用休息客户端的一些链接.请指导我这个.
这可能是一个愚蠢的问题,但我没有其他选择可以学习.
提前致谢.
我不会在Spring中编写Spring Boot Application,它将监视Windows中的目录,当我更改子文件夹或添加新的文件夹或删除现有的文件夹时,我想获取有关该文件夹的信息。
我怎样才能做到这一点?我已经读过这篇文章:http : //docs.spring.io/spring-integration/reference/html/files.html 和google中“ spring file watcher”下的每个结果,但是我找不到解决方案...
您是否有类似这样的好文章或示例?我不想这样:
@SpringBootApplication
@EnableIntegration
public class SpringApp{
public static void main(String[] args) {
SpringApplication.run(SpringApp.class, args);
}
@Bean
public WatchService watcherService() {
...//define WatchService here
}
}
Run Code Online (Sandbox Code Playgroud)
问候
我正在使用Spring REST,Websocket/STOMP和RabbitMQ开发消息传递应用程序.我们使用gatling来加载/压力测试应用程序的REST端点.但是,我们想知道Spring Websocket/STOMP端点可以处理多少消息.虽然Gatling有Web套接字,RabbitMQ和ActiveMQ扩展,但我找不到专门用于测试STOMP端点的扩展.
您能否建议一个可用于加载/压力测试Spring Websocket/STOMP端点的工具/框架?
有人知道任何Spring Boot与Kafka Connect的集成吗?我认为有一个spring-kafka项目可以很好地与Kafka客户端集成,但不能连接和流式API.
spring spring-integration spring-xd spring-boot apache-kafka-connect
我正在使用一个使用Spring Boot版本2.0.4.RELEASE和RabbitMQ版本3.7.7 的Java应用程序.该应用程序正在缓存来自Redis数据库中RabbitMQ的所有消息,并且必须在RabbitMQ中创建新队列时重新发送.目前,我设法使用Event Exchange插件和队列名称捕获队列创建.我正在使用AMQP出站适配器将消息发送回RabbitMQ.
外流
public IntegrationFlow outFlow(AmqpTemplate amqpTemplate) {
return IntegrationFlows.from(outputChannel())
.handle(Amqp.outboundAdapter(amqpTemplate)
.routingKeyExpression("headers.routingKey")
.exchangeNameExpression("headers.exchange"))
.get();
}
Run Code Online (Sandbox Code Playgroud)
我可以使用routingKey将消息发送到特定的交换.但是,我不知道如何在出站适配器中配置队列名称.这样我就可以将消息发送到特定的队列.
spring ×4
java ×2
spring-boot ×2
apache-kafka ×1
asynchronous ×1
concurrency ×1
esb ×1
gatling ×1
jmeter ×1
mule ×1
rabbitmq ×1
soa ×1
sockets ×1
spring-amqp ×1
spring-xd ×1