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
2
votes
1 answer

Retrieve JMS Headers right after the message is sent without consuming the message

How can I retrieve JMS Message headers after sending the message but without consuming the message ? this is my message sending code jmsTemplate.convertAndSend(que, text, message -> { LOGGER.info("setting JMS Message header values"); …
user2340345
  • 793
  • 4
  • 16
  • 38
2
votes
1 answer

send multiple jms messages in one transaction

I have to send a message to 2 different queues(queue1 and queue2). However, i want to rollback, if the send is failed for any of the queue(queue1 or queue2). my source code looks as follows. can anyone through some inputs on this. public void…
Srinivas KK
  • 151
  • 3
  • 12
2
votes
2 answers

How can I prevent Spring JmsTemplate unit test from blocking when reading ActiveMQ queue?

How can I prevent Spring JmsTemplate unit test sendAndReceivePerson() from blocking when attempting to read a Person object from ActiveMQ queue person.queue? The test creates a Person object, sends it to queue person.queue (this should also create…
Derek Mahar
  • 27,608
  • 43
  • 124
  • 174
2
votes
1 answer

Failed to convert property value of type 'com.ibm.mq.jms.MQQueueConnectionFactory' to required type 'javax.jms.ConnectionFactory'

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XMqJmsTemplate' defined in class path resource [applicationContext-XMq.xml]: Initialization of bean failed; nested exception is…
2
votes
2 answers

How to pause @JmsListener in my spring boot application?

Here are my Hornetq configuration in spring boot. spring.hornetq.mode=embedded spring.hornetq.embedded.enabled=true spring.hornetq.embedded.persistent=true spring.hornetq.port=5445 spring.hornetq.embedded.queues=jms.testqueue Here is my Producer…
NagaRajendra
  • 159
  • 3
  • 16
2
votes
1 answer

org.springframework.jms.JmsSecurityException: Access denied to resource: type=

I'm receiving a JmsSecurityException when publish to a secured WebLogic JMS queue using a Spring's JmsTemplate. The troubling part is that I'm able to publish successfully using an equivalent non-Spring bit of code. Below is the exception being…
Beau Grantham
  • 3,435
  • 5
  • 33
  • 43
2
votes
1 answer

Camel jms to external activeMQ with request-reply gives javax.jms.InvalidDestinationException: Cannot publish to a deleted Destination:

We have third party applications that make restful calls to camel cxfrs endpoint which is then routed to an external activeMQ. There are applications consuming these JMS messages and provide XML responses. This is all done synchronously using camel…
myspri
  • 283
  • 7
  • 14
2
votes
0 answers

Dequeue ADT (user type) messages from AQ using JMS

I need to work with Oracle AQ with ADT payload messages through JMS. Enqueing was simple (follow article http://blog.nominet.org.uk/tech/2007/10/04/spring-jms-with-oracle-aq/): transactionTemplate.execute(new TransactionCallbackWithoutResult() { …
Jarek
  • 21
  • 2
1
vote
1 answer

Spring JMS injection causing application not to startup

We have a spring application that publishes and listens to queues on a remote application server. My publisher and listener which are spring based listen within our own application server. One of the problems we have for our test environments is…
Peter Delaney
  • 5,278
  • 9
  • 33
  • 40
1
vote
1 answer

Lazy init not honored for JmsTemplate

We are developing a Spring-based application that utilizes JMSTemplate to send/receive JMS messages to/from the Tibco EMS Server. With the current implementation, during the TomCat start up the project fails if the EMS Server is down. This is…
Erikson
  • 549
  • 1
  • 6
  • 16
1
vote
0 answers

JMS MQ without JNDI

Due to some reason as we cannot use JNDI, can we use below code in spring application context ? Its working fine but need to know if any improvement/optimization is needed. Please note that almost 10 web applications will have this code and each…
Sanjay
  • 165
  • 1
  • 13
1
vote
0 answers

Spring ActiveMQ - expecting jmsTemplate.receive() to be transactional

In the current Spring Boot environment with ActiveMQ, we have to read the messages from the queue via 'pulling'. When I put the jmsTemplate.receive() within an transaction, I expected that any exception would put the message back on the queue. Alas,…
tm1701
  • 7,307
  • 17
  • 79
  • 168
1
vote
2 answers

what does the purpose of JMSTemplate.execute

Anyone can explain the real purpose of JMSTemplate.execute method. It can accept a session callback. The Spring document does not say any details about it.
user705414
  • 20,472
  • 39
  • 112
  • 155
1
vote
1 answer

Spring, Multithreading and jms

Should the JmsTemplate bean be declared as a prototype bean or as a singleton? I think either option is reasonable and it seems to me it's mainly a question of how Spring implemented that bean but I keep finding conflicting reports about the use…
Ittai
  • 5,625
  • 14
  • 60
  • 97
1
vote
0 answers

JMS template to publish and subscribe to Oracle AQ

I am trying to connect to Oracle AQ using JMS template to publish and subscribe. However, I am unable to get it working. I might be lacking basic understanding of connecting to Oracle AQ in general. Any advice would be appreciated Following is my…