public class RabbitStreamTemplate extends Object implements RabbitStreamOperations, BeanNameAware
RabbitStreamOperations
.Modifier and Type | Field and Description |
---|---|
protected LogAccessor |
logger |
Constructor and Description |
---|
RabbitStreamTemplate(com.rabbitmq.stream.Environment environment,
String streamName)
Construct an instance with the provided
Environment . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ListenableFuture<Boolean> |
convertAndSend(Object message)
Convert to and send a Spring AMQP message.
|
ListenableFuture<Boolean> |
convertAndSend(Object message,
MessagePostProcessor mpp)
Convert to and send a Spring AMQP message.
|
com.rabbitmq.stream.MessageBuilder |
messageBuilder()
Return the producer's
MessageBuilder to create native stream messages. |
MessageConverter |
messageConverter()
Return the message converter.
|
ListenableFuture<Boolean> |
send(Message message)
Send a Spring AMQP message.
|
ListenableFuture<Boolean> |
send(com.rabbitmq.stream.Message message)
Send a native stream message.
|
void |
setBeanName(String name) |
void |
setMessageConverter(MessageConverter messageConverter)
Set a converter for
convertAndSend(Object) operations. |
void |
setProducerCustomizer(ProducerCustomizer producerCustomizer)
Used to customize the
ProducerBuilder before the Producer is built. |
void |
setStreamConverter(StreamMessageConverter streamConverter)
Set a converter to convert from
Message to Message
for send(Message) and convertAndSend(Object) methods. |
StreamMessageConverter |
streamMessageConverter()
Return the stream message converter.
|
protected final LogAccessor logger
public RabbitStreamTemplate(com.rabbitmq.stream.Environment environment, String streamName)
Environment
.environment
- the environment.streamName
- the stream name.public void setBeanName(String name)
setBeanName
in interface BeanNameAware
public void setMessageConverter(MessageConverter messageConverter)
convertAndSend(Object)
operations.messageConverter
- the converter.public void setStreamConverter(StreamMessageConverter streamConverter)
Message
to Message
for send(Message)
and convertAndSend(Object)
methods.streamConverter
- the converter.public void setProducerCustomizer(ProducerCustomizer producerCustomizer)
ProducerBuilder
before the Producer
is built.producerCustomizer
- the customizer;public MessageConverter messageConverter()
RabbitStreamOperations
messageConverter
in interface RabbitStreamOperations
public StreamMessageConverter streamMessageConverter()
RabbitStreamOperations
streamMessageConverter
in interface RabbitStreamOperations
public ListenableFuture<Boolean> send(Message message)
RabbitStreamOperations
send
in interface RabbitStreamOperations
message
- the message.public ListenableFuture<Boolean> convertAndSend(Object message)
RabbitStreamOperations
convertAndSend
in interface RabbitStreamOperations
message
- the payload.public ListenableFuture<Boolean> convertAndSend(Object message, @Nullable MessagePostProcessor mpp)
RabbitStreamOperations
MessagePostProcessor
is
provided and returns null
, the message is not sent and the future is
completed with false
.convertAndSend
in interface RabbitStreamOperations
message
- the payload.mpp
- a message post processor.public ListenableFuture<Boolean> send(com.rabbitmq.stream.Message message)
RabbitStreamOperations
send
in interface RabbitStreamOperations
message
- the message.RabbitStreamOperations.messageBuilder()
public com.rabbitmq.stream.MessageBuilder messageBuilder()
RabbitStreamOperations
MessageBuilder
to create native stream messages.messageBuilder
in interface RabbitStreamOperations
RabbitStreamOperations.send(com.rabbitmq.stream.Message)
public void close()
Close the underlying producer; a new producer will be created on the next operation that requires one.
close
in interface AutoCloseable
close
in interface RabbitStreamOperations