订单服务延迟消息队列发送测试
This commit is contained in:
parent
d37c46342f
commit
64efdd1f5e
@ -0,0 +1,35 @@
|
|||||||
|
package biz;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.jieyuu.OrderApplication;
|
||||||
|
import net.jieyuu.model.CouponRecordMessage;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = OrderApplication.class)
|
||||||
|
@Slf4j
|
||||||
|
public class DemoApplicationTests {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void send() {
|
||||||
|
rabbitTemplate.convertAndSend("order.event.exchange", "order.close.delay.routing.key", "this is a new order");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCouponRecordRelease() {
|
||||||
|
CouponRecordMessage message = new CouponRecordMessage();
|
||||||
|
message.setOutTradeNo("123456abc");
|
||||||
|
message.setTaskId(1l);
|
||||||
|
rabbitTemplate.convertAndSend("order.event.exchange", "order.close.delay.routing.key", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user