public class SpringAmqpStubMessages extends Object implements MessageVerifier<org.springframework.amqp.core.Message>
MessageVerifier
implementation to integrate with plain
spring-amqp/spring-rabbit. It is meant to be used without interacting with a running
bus.
It relies on the RabbitTemplate to be a spy to be able to capture send messages.
Messages are not sent to the bus - but are handed over to a
SimpleMessageListenerContainer
which allows us to test the full deserialization
and listener invocation.Constructor and Description |
---|
SpringAmqpStubMessages(org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate,
org.springframework.cloud.contract.verifier.messaging.amqp.MessageListenerAccessor messageListenerAccessor)
Deprecated.
|
SpringAmqpStubMessages(org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate,
org.springframework.cloud.contract.verifier.messaging.amqp.MessageListenerAccessor messageListenerAccessor,
org.springframework.boot.autoconfigure.amqp.RabbitProperties rabbitProperties) |
Modifier and Type | Method and Description |
---|---|
org.springframework.amqp.core.Message |
receive(String destination)
Receives the message from the given destination.
|
org.springframework.amqp.core.Message |
receive(String destination,
long timeout,
TimeUnit timeUnit)
Receives the message from the given destination.
|
void |
send(org.springframework.amqp.core.Message message,
String destination)
Sends the message to the given destination.
|
<T> void |
send(T payload,
Map<String,Object> headers,
String destination)
Sends the given payload with headers, to the given destination.
|
@Deprecated public SpringAmqpStubMessages(org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate, org.springframework.cloud.contract.verifier.messaging.amqp.MessageListenerAccessor messageListenerAccessor)
@Autowired public SpringAmqpStubMessages(org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate, org.springframework.cloud.contract.verifier.messaging.amqp.MessageListenerAccessor messageListenerAccessor, org.springframework.boot.autoconfigure.amqp.RabbitProperties rabbitProperties)
public <T> void send(T payload, Map<String,Object> headers, String destination)
MessageVerifier
send
in interface MessageVerifier<org.springframework.amqp.core.Message>
T
- payload typepayload
- payload to sendheaders
- headers to senddestination
- destination to which the message will be sentpublic void send(org.springframework.amqp.core.Message message, String destination)
MessageVerifier
send
in interface MessageVerifier<org.springframework.amqp.core.Message>
message
- to senddestination
- destination to which the message will be sentpublic org.springframework.amqp.core.Message receive(String destination, long timeout, TimeUnit timeUnit)
MessageVerifier
receive
in interface MessageVerifier<org.springframework.amqp.core.Message>
destination
- destination from which the message will be receivedtimeout
- timeout to wait for the messagetimeUnit
- param to define the unit of timeoutpublic org.springframework.amqp.core.Message receive(String destination)
MessageVerifier
receive
in interface MessageVerifier<org.springframework.amqp.core.Message>
destination
- destination from which the message will be receivedCopyright © 2016–2019 Spring. All rights reserved.