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) |
| 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.
|
@Autowired
public SpringAmqpStubMessages(org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate,
org.springframework.cloud.contract.verifier.messaging.amqp.MessageListenerAccessor messageListenerAccessor)
public <T> void send(T payload,
Map<String,Object> headers,
String destination)
MessageVerifiersend in interface MessageVerifier<org.springframework.amqp.core.Message>public void send(org.springframework.amqp.core.Message message,
String destination)
MessageVerifiersend in interface MessageVerifier<org.springframework.amqp.core.Message>public org.springframework.amqp.core.Message receive(String destination, long timeout, TimeUnit timeUnit)
MessageVerifierreceive in interface MessageVerifier<org.springframework.amqp.core.Message>public org.springframework.amqp.core.Message receive(String destination)
MessageVerifierreceive in interface MessageVerifier<org.springframework.amqp.core.Message>Copyright © 2016–2018 Spring. All rights reserved.