Questions tagged [jmstemplate]

Spring helper class that simplifies synchronous JMS access code

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.

The JmsTemplate class is the central class in the JMS core package. It simplifies the use of JMS since it handles the creation and release of resources when sending or synchronously receiving messages.

Code that uses the JmsTemplate only needs to implement callback interfaces giving them a clearly defined high level contract. The MessageCreator callback interface creates a message given a Session provided by the calling code in JmsTemplate. In order to allow for more complex usage of the JMS API, the callback SessionCallback provides the user with the JMS session and the callback ProducerCallback exposes a Session and MessageProducer pair.

206 questions
21
votes
4 answers

ACTIVEMQ- publisher subscriber hello world example

There are two programs: subscriber and publisher... Subscriber is able to put the message onto the topic and the message is sent successfully. When I check the activemq server on my browser it shows 1 msg enqueued . But when I run the consumer code,…
Vijet Badigannavar
  • 271
  • 1
  • 3
  • 5
20
votes
3 answers

What are template classes in Spring Java? Why are they called templates? For example jdbc-template, jms-template etc

I'm new to Java. I've only been programming it for about a year. What does Spring mean by the use of templates? In Spring, there is jdbc-templates, jms-templates etc.. What are template classes in java? Are they a special kind of design pattern or…
Horse Voice
  • 8,138
  • 15
  • 69
  • 120
12
votes
3 answers

Unit testing with JMS (ActiveMQ)

How to do unit testing with JMS ? Is it some de-facto for this ? I googled something - Unit testing for JMS: http://activemq.apache.org/how-to-unit-test-jms-code.html - jmsTemplate: activemq.apache.org/jmstemplate-gotchas.html - mockRunner :…
Larry Cai
  • 55,923
  • 34
  • 110
  • 156
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
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
5 answers

Async consumer for Amazon sqs

I am new to working with queues. I am able to successfully post messages and receive them synchronously However, I am now trying to async now. The reference links provided by sqs suggests using jmsclient wrapper. And the link also mentions to use…
user5118993
  • 399
  • 1
  • 2
  • 20
9
votes
2 answers

Spring JMSTemplate receive all messages in one transaction

I am trying to get all messages from the queue in synchronous mode using Spring JMSTemplate.receive(String) method. The problem is that I get always only one message. Here is the code: @Transactional public List receiveAllFromQueue(String…
Krzysztof Cislo
  • 361
  • 1
  • 4
  • 9
8
votes
1 answer

How to send header message in JmsTemplate?

I am trying to insert message header into amq. There is no specific method in JMSTemplate for setting header in amq. when I set like this it will save in StringProperty instead of header. For saving into header how to pass data …
sudar
  • 1,446
  • 2
  • 14
  • 26
8
votes
1 answer

how to configure jms template at spring for weblogic?

as my question title, how to configure jms template at spring for weblogic? i follow an example at some website, but spring always complain about defaultDestination at JmsTemplate how to configure it correctly ?
Jeg Bagus
  • 4,895
  • 9
  • 43
  • 54
6
votes
2 answers

Does Spring JmsTemplate close connections by default?

I wrote a JMS application that runs within a web service in Glassfish (also deployed it in JBoss), I noticed that after I process several messages through a MessageListener MDP, the JMS server runs out of connections! Tried it with both Apache…
wsb3383
  • 3,841
  • 12
  • 44
  • 59
6
votes
5 answers

Unit testing code that sends JMS messages

I have a class that after it does some stuff, sends a JMS message. I'd like to unit test the "stuff", but not necessarily the sending of the message. When I run my test, the "stuff" green bars, but then fails when sending the message (it should, the…
bmw0128
  • 1,625
  • 6
  • 25
  • 31
5
votes
0 answers

Java Spring JMS: JmsTemplate to IBM MQ

Update It was my mistake I forget the ssl debugging running, it is super fast now and working like magic I have a Spring Boot application that connects to IBM MQ using spring JMS. I realized that the jmsTemplate is super slow compared to not using…
Rand0m
  • 342
  • 1
  • 4
  • 10
5
votes
3 answers

JmsTemplate has no send timeout

I have working JMS application with IBM MQ jars configuration , using spring It works well with correct queue information , but when i give wrong queue information it is hung at LOG.info("SENDING MESSAGE"); jmsTemplate.send(this.getDestination(),…
anshulkatta
  • 2,044
  • 22
  • 30
4
votes
0 answers

How to write JUnit test case for JMS client in Spring Boot

I have to write unit test for my producer and consumer in ActiveMQ Artemis. I'm using publish-subscribe model. How do I write the test cases for both? The following is my producer code: @Component public class OrderPublisher { @Autowired …
4
votes
2 answers

Compile Error when using Spring JMS

I'm running into a compile error while trying to use Spring-JMS. A quick Google search only turned up one matching result, but I was unable to get anything useful out of it. I'm using the following code: public class Class extends AbstractClass { …
dskiles
  • 851
  • 1
  • 13
  • 24
1
2 3
13 14