spring-jms

Is it possible to connect to spring boot embedded ActiveMQ instance from another application(started in separate process)?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 00:30:57
问题 I've read several examples about jms support in spring boot. and usually sender, receiver and active-mq(actually it can be any other jms compatible message broker) locates within the same application. I know that I can use stand alone active mq and use properties: spring.activemq.broker-url=tcp://192.168.1.210:9876 spring.activemq.user=admin spring.activemq.password=secret But I want to have 2 applications: 1- sender (connects to jms from receiver embedded and sends messages there) 2-receiver

Spring Bean Custom Scope JMS

纵饮孤独 提交于 2019-12-01 20:14:47
I am using Spring Framework to concurrently consume messages off of a JMS queue using a DefaultMessageListenerContainer . I want the ability to create new instances of the beans that are autowired for each message that comes in. I thought setting the scope="prototype" would work but it doesn't seem to do the job. Does anybody know of a custom bean scope that would create new instances per JMS message ? Much like the "request" scope does for HTTP Requests? I realize that I could make com.sample.TestListener "BeanFactoryAware" and then just do a getBean("foo") in my onMessage but I wanted to

How to add multiple JMS MessageListners in a single MessageListenerContainer for Spring Java Config

…衆ロ難τιáo~ 提交于 2019-12-01 16:04:07
I had the following xml code in my spring-config.xml <jms:listener-container acknowledge="auto" connection-factory="cachedConnectionFactory" container-type="default" error-handler="consumerErrorHandler" concurrency="20-25"> <jms:listener destination="#{TaskFinished.destination}" method="onMessage" ref="taskFinished" /> </jms:listener-container> Now, I was converting my spring xml configuration file to Java configuration. I translated it like @Bean(name = "consumerJmsListenerContainer") public DefaultMessageListenerContainer consumerJmsListenerContainer() { DefaultMessageListenerContainer

JMS message redelivery on exception in JMS listener

梦想的初衷 提交于 2019-12-01 06:29:06
Javadoc for org.springframework.jms.listener.AbstractMessageListenerContainer states, that if "sessionAcknowledgeMode" set to "CLIENT_ACKNOWLEDGE": Automatic message acknowledgment after successful listener execution; no redelivery in case of exception thrown. I guess, "no redelivery in case of exception thrown" means, that message would not be redelivered (so, my guess, it would be acknowledged), even if there's an exception thrown in the jms listener. But, well, exception thrown from listener means that call to it wasn't successful, and there should be redelivery due to no acknowledgement.

JMS message redelivery on exception in JMS listener

左心房为你撑大大i 提交于 2019-12-01 04:56:41
问题 Javadoc for org.springframework.jms.listener.AbstractMessageListenerContainer states, that if "sessionAcknowledgeMode" set to "CLIENT_ACKNOWLEDGE": Automatic message acknowledgment after successful listener execution; no redelivery in case of exception thrown. I guess, "no redelivery in case of exception thrown" means, that message would not be redelivered (so, my guess, it would be acknowledged), even if there's an exception thrown in the jms listener. But, well, exception thrown from

DefaultMessageListenerContainer not scaling

自古美人都是妖i 提交于 2019-12-01 04:56:36
I have a DefaultMessageListenerContainer, which is (in my opinion) not scaling up. The Container is defined to listen on a queue, where 100 messages are located in. I would expect, that the Container is going to any lengths, that the messages would be consumed as fast as it is possible (by observing the maxConcurrentConsumers configuration). So i would assume, that there are 7 concurrentConsumers. (beginning by 2 concurrentConsumers at container-startup) Some logging-information: activeConsumerCount: 5 concurrentConsumers: 2 scheduledConsumerCount: 5 idleConsumerLimit: 1 idleTaskExecLimit: 1

Disabling Spring JMS Auto configuration in Spring Boot Application

那年仲夏 提交于 2019-12-01 02:51:20
In my spring boot application i configure two different instances of MQQueueConnectionFactory (different id) as it is a need of the application. For that i have added ibm client jars. I have also added spring-jms dependency in my code as i wanted JmsTemplate etc classes. After adding this dependency, JmsAutoConfiguration finds JmsTemplate in classpath and tries to configure beans. In this process, it tries to inject bean of type ConnectionFactory and this is where the code fails and i start getting the error. Below is the code from JmsAutoConfiguration @Configuration @ConditionalOnClass

DefaultMessageListenerContainer not scaling

痞子三分冷 提交于 2019-12-01 01:52:46
问题 I have a DefaultMessageListenerContainer, which is (in my opinion) not scaling up. The Container is defined to listen on a queue, where 100 messages are located in. I would expect, that the Container is going to any lengths, that the messages would be consumed as fast as it is possible (by observing the maxConcurrentConsumers configuration). So i would assume, that there are 7 concurrentConsumers. (beginning by 2 concurrentConsumers at container-startup) Some logging-information:

How to share messages, published on Topic, between multiple VMs, in Spring Jms Tibjms

扶醉桌前 提交于 2019-11-30 23:49:59
My application is consuming messages published to a Topic. I have 3 servers where my application code is running. With current implementation, the messages is distributed to all running VMs i.e. copy of message is received by every consumer. My requirement is that every consumer should receive distinct message i.e. no two consumer should get same message. Below are the libraries I am using: spring jms 4.2.7 Java jms 2.0 tibco jms 8.0 wildfly-swarm as server Currently I have following configuration : TibjmsConnectionFactory factory = new TibjmsConnectionFactory("server-url"); factory

How to listen to topic using spring boot jms

瘦欲@ 提交于 2019-11-30 21:17:58
I am trying to listen to topic using the below snippet. However its listening to queue by default. There is no xml config in this case. I am completely relying on annotations. Moreover I have relied completely on the AutoConfiguration provided by Spring boot. I am not sure how to set the destination type as topic, In JmsListener. Spring JMS gurus please help. @Component public class MyTopicListener { @JmsListener(destination = "${trans.alert.topic}") public void receiveMessage(TransactionAlert alert) { logger.info("AlertSubscriberEmail :: Sending Email => <" + alert + ">"); } } I just took the