Top Description Methods
org.springframework.jms.core

public Interface ProducerCallback<T>

Annotations
@FunctionalInterface
Type Parameters
<T>
the result type
Imports
jakarta.jms.JMSException, .MessageProducer, .Session, org.springframework.lang.Nullable

Callback for sending a message to a JMS destination.

To be used with JmsTemplate's callback methods that take a ProducerCallback argument, often implemented as an anonymous inner class or as a lambda expression.

The typical implementation will perform multiple operations on the supplied JMS Session and MessageProducer.

Author
Mark Pollack
Since
1.1
See Also
JmsTemplate#execute(ProducerCallback), JmsTemplate#execute(jakarta.jms.Destination, ProducerCallback), JmsTemplate#execute(String, ProducerCallback)

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

a result object from working with the Session, if any (or null if none)
doInJms
(Session
the JMS Session object to use
session
,
MessageProducer
the JMS MessageProducer object to use
producer
)

Perform operations on the given Session and MessageProducer.

Method Detail

doInJmsback to summary
public T doInJms(Session session, MessageProducer producer) throws JMSException

Perform operations on the given Session and MessageProducer.

The message producer is not associated with any destination unless when specified in the JmsTemplate call.

Parameters
session:Session

the JMS Session object to use

producer:MessageProducer

the JMS MessageProducer object to use

Returns:T

a result object from working with the Session, if any (or null if none)

Annotations
@Nullable
Exceptions
JMSException:
if thrown by JMS API methods