Package org.springframework.jms.core
Interface ProducerCallback<T>
- Type Parameters:
T
- the result type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ProducerCallback<T>
Callback for sending a message to a JMS destination.To be used with
JmsTemplate
's callback methods that take aProducerCallback
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
andMessageProducer
.- Since:
- 1.1
- Author:
- Mark Pollack
- See Also:
JmsTemplate.execute(ProducerCallback)
,JmsTemplate.execute(javax.jms.Destination, ProducerCallback)
,JmsTemplate.execute(String, ProducerCallback)
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
doInJms(Session session, MessageProducer producer)
Perform operations on the givenSession
andMessageProducer
.
Method Detail
doInJms
@Nullable T doInJms(Session session, MessageProducer producer) throws JMSException
Perform operations on the givenSession
andMessageProducer
.The message producer is not associated with any destination unless when specified in the JmsTemplate call.
- Parameters:
session
- the JMSSession
object to useproducer
- the JMSMessageProducer
object to use- Returns:
- a result object from working with the
Session
, if any (ornull
if none) - Throws:
JMSException
- if thrown by JMS API methods