spring-jms

Safely Terminating a Spring JMS application

此生再无相见时 提交于 2019-12-10 19:57:20
问题 I'm working on a Spring boot JMS application that is setup strictly with bean annotations and is reading messages from WebshpereMQ. Everything works except I can't figure out how to safely shutdown this application. Once my JMSListener Method reads all the messages it just stays idle. I make an initial connection to the queue and access the queue depth, so ideally when queue depth is zero, it needs to wrap it up and shut down. My current workaround (and I do not like it at all) is this little

ActiveMQ gives: “Could not connect to broker URL: tcp://localhost:61616” after around 10 000 messages

泪湿孤枕 提交于 2019-12-10 19:33:46
问题 ActiveMQ gives: "javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.BindException: Address already in use: connect" after around 10 000 messages Then after a some time (around 1-5 seconds) start to get messages with no issue. I'm using Spring Boot 2.0.4 with very basic configuration: spring.activemq.broker-url=tcp://localhost:61616 spring.activemq.user=admin spring.activemq.password=admin spring.activemq.packages.trust-all=true I used JmsTemplate

DefaultMessageListenerContainer not receiving messages

青春壹個敷衍的年華 提交于 2019-12-10 15:09:59
问题 I have a DefaultMessageListenerContainer configured as follows: DefaultMessageListenerContainer container = new DefaultMessageListenerContainer(); container.setConcurrentConsumers(4); container.setConnectionFactory(connectionFactory); container.setDestinationName(String.format("Consumer.%s.VirtualTopic.%s", group, topic)); container.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE); container.setSessionTransacted(true); container.setMessageListener(new DelegatingMessageListener(listener,

Spring JMSListener - How should it handle empty payloads?

假如想象 提交于 2019-12-10 14:18:49
问题 I asked basically the same thing a few months ago with this post: How should a Spring JMS listener handle a message with an empty payload?, but all I got was a measly comment suggesting I "re-write my listener to do what I want". Valid statement, but unclear in my eyes as I'm still coming to grips with Spring-Boot. I've learned since then and want to re-ask this question more directly (as opposed to placing a bounty on the old one). I set up an annotated bean class with @Configuration and

Spring Service @Transactional doesn't rollback transaction Mybatis SqlSession

血红的双手。 提交于 2019-12-10 12:47:06
问题 The goal is to rollback all/any transactions in case of failure. But this doesn't work as expected. We use Spring MVC + JMS + Service + Mybatis. In the logs, the JMS is set to rollback, but the row is inserted and not rollback. Would like to know what I'm missing or doing wrong? The @Transactional tag was added recently. So not sure if it works as expected. Code: Service Class: @Transactional(value = "transactionManager", propagation = Propagation.REQUIRED, rollbackFor = Exception.class)

openwire vs amqp, Which would perform better

烈酒焚心 提交于 2019-12-08 08:38:47
We currently use JMS API with ActiveMQ broker, looking over to move to RabbitMQ. Compared to openWire vs amqp which one would give best performance with java client-producer. I Couldn't find a comparison study on amqp(RabbitMQ) vs openwire (activeMQ) native protocol. I'm looking in terms of raw performance and ease of scalability. We currently use Spring Integration for ActiveMQ, I would like to know if its a drastic change to move to RabbitMQ(AMQP) even with Spring Integration. Is there any bridge similar to what ActiveMQ uses to do JMS<->AMQP forwarding ? ActiveMQ also supports AMQP: http:/

openwire vs amqp, Which would perform better

烂漫一生 提交于 2019-12-08 08:34:42
问题 We currently use JMS API with ActiveMQ broker, looking over to move to RabbitMQ. Compared to openWire vs amqp which one would give best performance with java client-producer. I Couldn't find a comparison study on amqp(RabbitMQ) vs openwire (activeMQ) native protocol. I'm looking in terms of raw performance and ease of scalability. We currently use Spring Integration for ActiveMQ, I would like to know if its a drastic change to move to RabbitMQ(AMQP) even with Spring Integration. Is there any

Error in setExceptionListener in sending message via JmsTemplate to ActivemQ (as external broker of Jboss-eap)

蹲街弑〆低调 提交于 2019-12-08 06:39:30
Based on this article , I've connected Jboss eap 6.2 to an external ActivemQ 5.9.0 . For sending/receiving message i'm using JmsTemplate and DefaultMessageListenerContainer in spring-jms 4.1.1 . Receiving message is working fine, but in sending message i get this error: 11:33:37,059 ERROR [stderr] java.lang.reflect.InvocationTargetException 11:33:37,060 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 11:33:37,060 ERROR [stderr] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 11:33:37,060 ERROR [stderr] at sun.reflect

Spring JMS start listening to jms queues on request

↘锁芯ラ 提交于 2019-12-08 06:38:35
问题 Spring provides @JMSListener annotation to listen to messages from a particular queue. There is also an alternative to implement JmsListenerConfigurer and register a MessageListener . In both the cases, the name of the queue has to be known at the time when the application starts, either by hardcoding in the code or via properties. Is there a way to listen to a queue whose name is known to the application much later after it started? 回答1: This should work. Configure the @JmsListener with a

Writing messages with Spring JmsTemplate using a TransactionManager

做~自己de王妃 提交于 2019-12-08 03:24:32
Using Spring-JMS it is possible to receive messages within an external transaction context via the DefaultMessageListenerContainer . However the only documented way to write a message is via JmsTemplate.send(…) and I can't see how this can be coerced to use a given TransactionManager . Can anyone point me in the right direction? More info: Ensuring a transaction manager is available ( WebSphereUowTransactionManager ), using JmsTemplate.write against an Oracle AQjmsFactory.getQueueConnectionFactory(dataSource) results in: org.springframework.jms.UncategorizedJmsException: Uncategorized