Questions tagged [spring-jms]

Spring provides a JMS integration framework that simplifies the use of the JMS API much like Spring's integration does for the JDBC API.

JMS can be roughly divided into two areas of functionality, namely the production and consumption of messages. The JmsTemplate class is used for message production and synchronous message reception. For asynchronous reception similar to Java EE’s message-driven bean style, Spring provides a number of message listener containers that are used to create Message-Driven POJOs (MDPs).

A getting started guide is available to help understand how these concepts work with a practical example.

Useful links:

1908 questions
11
votes
1 answer

SQS Message visibility timeout being set to 0 when exception is thrown and @JMSListener

I have a simple Spring Boot service that listens to an AWS SQS queue using JMSTemplate. Everything works as expected when the message is properly handled. I am using CLIENT_ACKNOWLEDGE so when an exception is thrown during processing, the message…
Robert P
  • 171
  • 2
  • 6
11
votes
1 answer

Writing tests to verify received msg in jms listener (Spring-Boot)

I want to write test for something like below; There is a listener called state-info-1 in src/main. It does some changes to any message it gets and publishes the new message on activemq topic state-info-2. I will build a dummy message and publish…
Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68
11
votes
1 answer

How to implement jms queue in spring boot

I have created a Spring Boot project using initializer and I am trying to create my first message but I have no idea where to start. I am familiar with the same process using JEE so I guess I need to create a factory, a sender and a consumer. Can…
Maria Georgiou
  • 133
  • 1
  • 1
  • 6
11
votes
3 answers

How to listen to topic using spring boot jms

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…
zikzakjack
  • 972
  • 2
  • 9
  • 20
10
votes
1 answer

Best practice for error handling with Spring JMS

I'm working on a message based service that queues all incoming requests and handles them later. What is the best practice for handling errors. For example malformed messages or communication errors when sending the information to the next system.…
Kristoffer
  • 1,633
  • 3
  • 19
  • 25
10
votes
2 answers

Spring Boot multiple JMS connections

I'm developing Spring Boot application which must connect to several WebSphere JMS connections with different ports or even ip addresses. I need receive and send messages to different queues. I took example of connection from this source -…
lalilulelo_1986
  • 526
  • 3
  • 7
  • 18
10
votes
2 answers

dynamically set @JmsListener destination from configuration properties

I want to be able to set the @JMSlistener destination from an application.properties my code looks like this @Service public class ListenerService { private Logger log = Logger.getLogger(ListenerService.class); @Autowired …
JaChNo
  • 1,493
  • 9
  • 28
  • 56
10
votes
2 answers

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

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…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
10
votes
3 answers

Spring Service @Transactional doesn't rollback transaction Mybatis SqlSession

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…
Harry
  • 546
  • 6
  • 22
  • 50
10
votes
1 answer

JMS and Spring batch

Our project is to integrate two applications, using rest api of each, using JMS(to provide asynchronous nature) and spring batch to read bulk data from the JMS queue and process it and then post it to the receiving application. I am a newbie to…
10
votes
1 answer

How to disable Spring @JmsListener programmatically on startup

I have a Spring application that has methods annotated with Spring's @JmsListener. The application is deployed on multiple nodes. On some specific nodes I need to disable the JMS listener so that it is not pulling messages off the queue. There…
sudr
  • 133
  • 1
  • 1
  • 5
10
votes
9 answers

Spring JMS(ActiveMQ) delayed delivery of messages

We're trying to set a delay on some JMS messages, so that a message will only be added to the queue/ received by the listener after x time. So far we've tried 2 approaches that didn't work. 1) According to the spring documentation, we can set the…
Ayelet
  • 1,713
  • 9
  • 29
  • 43
10
votes
2 answers

Closing Session when using Spring's CachingConnectionFactory

The java doc here related to Spring CachingConnectionFactory has comment : NOTE: This ConnectionFactory requires explicit closing of all Sessions obtained from its shared Connection. This is the usual recommendation for native JMS access code…
Gaurav
  • 1,549
  • 2
  • 15
  • 31
10
votes
2 answers

Purpose of taskExecutor property in Spring's DefaultMessageListenerContainer

The Spring's DefaultMessageListenerContainer (DMLC) has concurrentConsumer and taskExecutor property. The taskExecutor bean can be given corePoolSize property. What is then the difference between specifying concurrentConsumer and corePoolSize ? When…
Gaurav
  • 1,549
  • 2
  • 15
  • 31
10
votes
2 answers

What's the correct Maven dependencies to use Spring JMS and ActiveMQ?

This is quite a common problem and I have found plenty solutions that do not work for me on the web. I am declaring: org.springframework spring-jms
user689842