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.

181 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
18
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
  • 7,218
  • 14
  • 56
  • 111
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
  • 45,222
  • 30
  • 104
  • 141
10
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
  • 151
  • 1
  • 6
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
  • 4
  • 9
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,525
  • 9
  • 40
  • 52
8
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
  • 359
  • 1
  • 2
  • 19
7
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,212
  • 2
  • 19
  • 40
6
votes
2 answers

JMS Sessions, "transacted" and "auto-acknowledge"

What does JMS session exactly mean? What does it mean that a JMS session can be or not "transacted"? What does it mean that a JMS session can be or not with "auto-acknowledge"?
Johan
  • 2,763
  • 7
  • 23
  • 33
6
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,305
  • 1
  • 11
  • 24
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,715
  • 11
  • 41
  • 59
5
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,545
  • 6
  • 24
  • 30
4
votes
0 answers

No qualifying bean of type 'org.springframework.jms.core.JmsTemplate'

I have following dependencies: org.springframework.boot spring-boot-starter-activemq 1.5.10.RELEASE
gstackoverflow
  • 31,683
  • 83
  • 267
  • 574
4
votes
1 answer

How does Setsessiontransacted work in JMSTemplate and DefaultMessageListenerContainer with Pub/sub model

I am using a publisher/subscriber model in which I am using JMSTemplate to publish messages onto a topic. I am using defaultmessagelistenercontainer to subscribe and receive messages. I know I can I set sessionTransacted true in both the…
4
votes
1 answer

Spring JmsTemplate and Apache ActiveMQ, why so many connections?

I have a web application that runs text processing jobs in the background once a message is received on an ActiveMQ which is listened to by a Spring MessageListener....the problem I"m encountering is that once I process around 30 background jobs,…
wsb3383
  • 3,715
  • 11
  • 41
  • 59
1
2 3
12 13