作为一名经验丰富的Spring用户,我假设Spring Integration在最近需要一些(JMS)消息传递功能的项目中更有意义(更多细节).使用Spring Integration几天之后,考虑到必须配置的通道数量,以便在适当的位置进行一些请求 - 响应(侦听不同的JMS队列)通信,它仍然会感觉很多配置开销.
因此,我正在寻找一些背景信息Camel与Spring Integration的不同之处,但似乎有很多信息,我发现:
问题是:你使用一个堆栈而不是另一个堆栈有什么经验?在哪些情况下你会推荐Camel是Spring Integration缺乏支持吗?你在哪里看到每个人的利弊?任何来自现实世界项目的建议都受到高度赞赏.
我正在低于例外
org.springframework.amqp.AmqpAuthenticationException:com.rabbitmq.client.AuthenticationFailureException:ACCESS_REFUSED - 使用身份验证机制PLAIN拒绝登录.有关详细信息,请参阅代理日志文件
配置:Windows上的RabbitMQ 3.3.5
在Config文件中,%APPDATA%\RabbitMQ\rabbit.config
我根据https://www.rabbitmq.com/access-control.html进行了以下更改
[{rabbit, [{loopback_users, []}]}].
Run Code Online (Sandbox Code Playgroud)
我也试过创建一个user/pwd - 测试/测试似乎没有让它工作.
试过这篇文章中的步骤.
其他配置详细信息如下:
Tomcat托管了Spring Application Context:
<!-- Rabbit MQ configuration Start -->
<!-- Connection Factory -->
<rabbit:connection-factory id="rabbitConnFactory" virtual-host="/" username="guest" password="guest" port="5672"/>
<!-- Spring AMQP Template -->
<rabbit:template id="rabbitTemplate" connection-factory="rabbitConnFactory" routing-key="ecl.down.queue" queue="ecl.down.queue" />
<!-- Spring AMQP Admin -->
<rabbit:admin id="admin" connection-factory="rabbitConnFactory"/>
<rabbit:queue id="ecl.down.queue" name="ecl.down.queue" />
<rabbit:direct-exchange name="ecl.down.exchange">
<rabbit:bindings>
<rabbit:binding key="ecl.down.key" queue="ecl.down.queue"/>
</rabbit:bindings>
</rabbit:direct-exchange>
Run Code Online (Sandbox Code Playgroud)
在我的控制器类中
@Autowired
RmqMessageSender rmqMessageSender;
//Inside a method
rmqMessageSender.submitToECLDown(orderInSession.getOrderNo());
Run Code Online (Sandbox Code Playgroud)
在我的邮件发件人: …
我有一个基于Spring Web模型 - 视图 - 控制器(Spring MVC 3.2.8)的应用程序,我想使用FTP SessionFactory的默认实现与FTP集成.
我有这段代码
private void performImport() throws Exception {
String fileNamePattern="*.txt";
ftpInboundFileSynchronizer = new FtpInboundFileSynchronizer(myFtpSessionFactory );
((FtpInboundFileSynchronizer) ftpInboundFileSynchronizer).setFilter(new FtpSimplePatternFileListFilter(fileNamePattern));
ftpInboundFileSynchronizer.setRemoteDirectory(remoteDirectory);
deleteLocalFiles();
System.out.println ("before synchronize");
ftpInboundFileSynchronizer.synchronizeToLocalDirectory(localDirectory);
System.out.println ("after synchronize");
}
Run Code Online (Sandbox Code Playgroud)
这是我在控制台中看到的:
before synchronize
after synchronize
Run Code Online (Sandbox Code Playgroud)
在FTP我有一个test.txt文件,但文件没有传输,我没有错误/异常
我也尝试过使用fileNamePattern="*.*";但它也不起作用
这是我的配置文件:
@Configuration
@PropertySource("classpath:/config/application.properties")
public class FtpConfiguration {
@Autowired
private SessionFactory myFtpSessionFactory;
@Bean
@Scope(value="step")
public FtpGetRemoteFilesTasklet myFtpGetRemoteFilesTasklet()
{
FtpGetRemoteFilesTasklet ftpTasklet = new FtpGetRemoteFilesTasklet();
ftpTasklet.setRetryIfNotFound(true);
ftpTasklet.setDownloadFileAttempts(3);
ftpTasklet.setRetryIntervalMilliseconds(10000);
ftpTasklet.setFileNamePattern("README");
//ftpTasklet.setFileNamePattern("TestFile");
ftpTasklet.setRemoteDirectory("/");
ftpTasklet.setLocalDirectory(new File(System.getProperty("java.io.tmpdir")));
ftpTasklet.setSessionFactory(myFtpSessionFactory);
return ftpTasklet; …Run Code Online (Sandbox Code Playgroud) 我有一个Web应用程序,它在一个独立的线程中运行Spring Integration逻辑.问题是,在某些时候,我的Spring Integration逻辑尝试使用请求范围的bean,然后我得到以下错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.tenantContext': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still …Run Code Online (Sandbox Code Playgroud) Gateway和Service Activator作为消息端点(在企业集成模式方面)有什么区别?
我需要在WAS ND 8.0集群下使用Apache Camel(或Spring Integration)运行组件.它们都在启动时运行一些线程,并在正常关闭时停止它们.提供WAS托管的线程池没问题.但是这些线程必须同时在单个集群的节点上运行.此外,它必须是高可用的,即当活动节点下降时切换到其他节点.
我找到的解决方案 - 是WAS Partitioning Facility.它需要额外的扩展部署许可证.这是唯一的方法,还是只有一些方法可以使用Network Deployment许可证来实现这一点?
提前致谢.
websphere singleton cluster-computing apache-camel spring-integration
我想利用XML配置文件中的一些Spring Boot自动配置的bean,但是当我尝试这样做时,我仍然遇到异常和错误.
例如,如果我的类路径上有数据相关的库,Spring Boot将自动配置一个DataSource对象,我可以将其自动装入我自己的bean和类中,如下所示:
@Configuration
@ImportResource("classpath:xmlconfig.xml")
public class Config {
// This works!!
@Autowired
private DataSource dataSource;
@Bean
public ClassThatRequiresADataSource() {
ClassThatRequiresADataSource foo = new ClassThatRequiresADataSource();
foo.setDataSource(dataSource);
return foo;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试在XML配置文件中执行相同操作,我将得到一个例外.我已经通过添加@ImportResource("classpath:xmlconfig.xml")到我的主配置类来引导XML配置文件.这是我正在谈论的一个例子......内部xmlconfig.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- THIS DOES NOT WORK! -->
<bean id="anotherClassThatRequiresADataSource" class="my.package.AnotherClassThatRequiresADataSource">
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
尽管dataSource是一个有效的,自动配置的Bean名称,上面将在运行Spring Boot应用程序时给出异常.我也尝试过自动配置ConnectionFactory(在类路径上使用ActiveMQ)和类路径上EntityManagerFactory使用Hibernate和JPA,但这些都不起作用.
基本上,我要问的是:什么相当于将Spring Boot自动配置的bean自动装配到XML配置文件中?
这是我的主要Spring Boot入口点,只是所有文档中列出的标准类:
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
public …Run Code Online (Sandbox Code Playgroud) 我已经完成了这一点并理解我需要创建一个TcpReceivingChannelAdapter接受连接.但我不知道如何处理.
有人可以指导我吗?
我是Spring Framework的新手,事实上,我正在学习和使用Spring Boot.最近,在我正在开发的应用程序中,我使Quartz Scheduler工作,现在我想让Spring Integration在那里工作:FTP连接到服务器来写入和读取文件.
我想要的是非常简单(因为我已经能够在以前的Java应用程序中这样做).我有两个Quartz Jobs计划每天在不同的时间点击:其中一个从FTP服务器读取文件,另一个将文件写入FTP服务器.
我将详细介绍我迄今为止开发的内容.
@SpringBootApplication
@ImportResource("classpath:ws-config.xml")
@EnableIntegration
@EnableScheduling
public class MyApp extends SpringBootServletInitializer {
@Autowired
private Configuration configuration;
//...
@Bean
public DefaultFtpsSessionFactory myFtpsSessionFactory(){
DefaultFtpsSessionFactory sess = new DefaultFtpsSessionFactory();
Ftp ftp = configuration.getFtp();
sess.setHost(ftp.getServer());
sess.setPort(ftp.getPort());
sess.setUsername(ftp.getUsername());
sess.setPassword(ftp.getPassword());
return sess;
}
}
Run Code Online (Sandbox Code Playgroud)
我将以下课程命名为FtpGateway,如下所示:
@Component
public class FtpGateway {
@Autowired
private DefaultFtpsSessionFactory sess;
public void sendFile(){
// todo
}
public void readFile(){
// todo
}
}
Run Code Online (Sandbox Code Playgroud)
我正在阅读本文档以学习如何操作.Spring Integration的FTP似乎是事件驱动的,所以我不知道如何在确切的时间触发触发器时执行Jobs中的sendFile()和readFile().
文档告诉我一些使用入站通道适配器(从FTP读取文件?),出站通道适配器(将文件写入FTP?)和出站网关(做什么?):
Spring Integration支持通过FTP/FTPS发送和接收文件,提供三个客户端端点:入站通道适配器,出站通道适配器和出站网关.它还为定义这些客户端组件提供了方便的基于命名空间的配置选项.
所以,我还没有明白如何遵循.
拜托,有人可以给我一个暗示吗? …
使用Kafka作为微服务架构中的消息传递系统,使用spring-kafka与spring-cloud-stream + spring-cloud-starter-stream-kafka有什么好处?
Spring云流框架支持更多的消息传递系统,因此具有更多的模块化设计.但功能呢?spring-kafka和spring-cloud-stream + spring-cloud-starter-stream-kafka的功能之间是否存在差距?哪个API设计得更好?
期待阅读您的意见
spring ×5
java ×3
spring-boot ×3
apache-camel ×2
ftp ×1
ftps ×1
jms ×1
messaging ×1
rabbitmq ×1
singleton ×1
spring-amqp ×1
spring-aop ×1
spring-kafka ×1
tcp ×1
websphere ×1