问题标签 [spring-jms]

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 投票
0 回答
1397 浏览

jms - 如何配置 ehcache.xml 使用 JMS + ActiveMQ + Tomcat 并在 JMS 服务器关闭的情况下启用 tomcat 启动?

我将 ehcache 与 JMS 复制和 ActiveMQ 一起用作 JMS 服务器。目前用于在 Hibernate 3.6.7 中缓存数据库结果

我的 cacheManager 配置如上:

复制和故障转移正常工作。如果 JMS 出现故障(复制停止)并且当 JMS 服务器再次启动时重新启动。

我面临的唯一问题是,如果 JMS 服务器在我的应用程序启动时关闭。应用程序无法启动。

可能是因为当 Spring 启动时,它会读取休眠配置,而当休眠加载应用程序时,它会冻结等待代理。

有没有人有解决这个问题的方法?

我在想是否有办法使用 spring jmsTemplate 配置来配置 ehcache.xml jndi 条目。

0 投票
2 回答
8171 浏览

jms - Spring DefaultMessageListenerContainer - 侦听器未读取 Websphere MQ 上的消息

我正在使用 Spring 3.0 - DefaultMessageListenerContainer 连接到 Websphere 6 MQ。MQ 上已经存在一些消息。当我运行测试时,会启动实现 SessionAwareMessageListener 的侦听器。但是 onMessage() 没有被调用。所以问题是已经在队列中的消息没有被读取。

根据文档, autoStartup 默认为 true(我没有更改此设置)。根据我的理解,在启动时,侦听器应该读取队列中的任何现有消息,并且应该调用 onMessage()。如果这种理解是错误的,请告诉我。

这是配置文件中的片段:

注意:没有错误/异常,测试应用程序启动正常。

任何解决此问题的指针都会有很大帮助。

谢谢,
RJ

0 投票
1 回答
1659 浏览

web-services - 如何从 Spring WS 应用程序向 WebSphere JMS Queue 发送消息

我是 Spring Web 服务和 Websphere 应用程序服务器的新手。

我正在开发 Spring Web 服务,并且有一个要求,一旦请求到来,我需要将 XML 消息发送到部署我的 Web 服务的服务器,在我的例子中是 WebSphere 应用程序服务器。我试过但没有得到任何具体的解决方案。我不知道 spring JMS 和 Web Sphere JMS MQ 集成需要做哪些 bean 配置。另外,如何创建 websphere JMS 队列。

我的环境相关细节是:

  • 春天 3.1.0
  • Spring-WS 2.0.2
  • Websphere 应用服务器 V8

让我知道是否需要更多详细信息。

任何帮助,将不胜感激。

0 投票
1 回答
32146 浏览

java - Does annotating a bean @DependsOn mean the dependent bean will be instantiated or initialized?

I am using Spring 3.0.2. I have two relatively simple bean definitions. One has a @PostConstruct (bean 'A') which triggers a chain of events that the @DependsOn bean (bean 'B') needs to be prepared for. However, it seems even though that I stated that the bean 'A' is dependent on bean 'B', the events (the lifecycle methods) of bean 'A' are running before bean 'B' is fully initialized.

Does stating that a bean is "dependent" via @DependsOn (or for that matter, depends-on in a bean definition) mean that the dependent bean's lifecycle methods will be completed before the bean that is dependent on said bean?

Will bean 'B' lifecycle methods be completed before bean 'A'?

UPDATE

Bean A is a custom class that is using a JMS Template to send a message announcing that he has initialized.

The recipient of said message processes it and forwards it's configuration to a MessageListeningContainer (Bean B).

The first part is happening all before Bean B has been started by the DefaultLifecycleProcessor.

I added in my init method the injection of bean b plus two logging statements:

I looked at the spring source and isActive is set to true after the Initialization method (doInitialized is completed). The isRunning is set after the doStart is completed. The doStart is triggered by the DefaultLifecycleProcessor which is occurring after the @PostConstruct annotated methods are called.

How can I guarantee that my Postconstruct method is called AFTER bean b has been initialized AND started?

0 投票
5 回答
51129 浏览

java - JMS消息监听器执行失败,没有设置ErrorHandler

当我使用 Spring 收听 JMS 消息时,我收到了上述错误。

我想知道如何将 Errorhandler 添加到 JMS 侦听器中?

0 投票
1 回答
10333 浏览

performance - Spring JMS 连接:性能注意事项

我需要向/从存储在单个 JMS 服务器上的不同主题发送/接收消息。

我想JmsTemplate用于发送和MessageListenerContainer注册异步监听器。

我的配置如下所示:

据我了解,singleConnectionFactory总是返回相同的连接实例,有助于减少每次jmsTemplate需要(例如)发送/接收消息时创建和关闭连接的开销(就像使用普通的一样ConnectionFactory)。

我的第一个问题是:如果我创建多个jmsTemplate(s),它们都可以共享一个 refsingleConnectionFactory吗?或者他们是否必须每个都接收一个不同的实例(singleConnectionFactory1,,singleConnectionFactory2等)?

阅读 API SingleConnectionFactory,我发现:

请注意,Spring 的消息侦听器容器支持Connection 在每个侦听器容器实例中使用共享。只有在多个侦听器容器之间共享单个 JMS 连接时,组合使用SingleConnectionFactory才真正有意义。

这对我来说听起来有点神秘。据我所知,每个 只能注册 1 个 Listener MessageListenerContainer,所以我不明白连接共享的程度。

假设我想注册 N 个 Listeners:我需要重复 N 次,如下所示:

在这种情况下,从 connectionFactory 创建了多少个连接?每个 ListenerContainer 一个或只是一个连接池?如果我为SimpleMessageListenerContainer-s 提供一个 refsingleConnectionFactory怎么办?

在这种情况下,最好的方法是什么(当然,从表演的角度来看)?

0 投票
1 回答
1371 浏览

java - Spring Framework JMS 目标名称解析方法

我想将创建/解析目的地的细节封装到某种 DestinationResolver 实现中。

详细信息是创建连接、创建会话、创建/解析目标。

这样的实现会是一个坏方法吗?

更新

将特定任务包装在执行操作中是否会有更好的方法?

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/core/JmsTemplate.html#execute(org.springframework.jms.core.SessionCallback )

0 投票
1 回答
3050 浏览

java - java.io.IOException:无法确定系统类型 - 响应:331 请指定密码

我们正在使用石英调度程序在我们的mediation server项目中运行多个作业,spring 3.0 框架,hibernate,Apache tomcat。加载 tomcat 容器时,调度程序作业开始启动。一个作业在特定时间执行(假设第一个作业需要 1 分钟,第二个作业需要 3 分钟)从 ftp 获取最新的 cdr 文件(使用 commons-net 2.2 jar 和 filezilla 3.5.3)复制到本地系统. 我们得到

两个作业同时执行时的问题。

这里有什么问题?

0 投票
1 回答
409 浏览

java - Springs onMessage 处理程序的事务支持

所以我有一些样板代码使用来自主题的消息:

我希望能够尝试将消息转换为另一个对象。如果这导致错误,我将使用我自己的异常处理来捕获它并将其写入错误队列。

我的问题是,如何将 Springs messageListenerContainer bean 设置为 Transactional 并且仅在成功发生时才使用???

[编辑] 这是到目前为止的bean:

0 投票
2 回答
10779 浏览

java - Spring ActiveMQ 问题

有点急请帮忙!

为什么我在 Spring 中得到 IllegalArgumentException 无法将 String 类型的值转换为所需的 Product 类型?

我已经阅读了这个问题,因为我遇到了类似的异常:

我也看到了这个问题的答案,现在我的问题是:如何确定我是否有定义参数的类似问题(我个人认为这不是问题(只是直觉) )? 或者这是其他问题吗?

请帮忙

这是xml文件: