|  | @@ -21,6 +21,10 @@ class ProducerApplicationTests {
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      RabbitTemplate rabbitTemplate;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * work queue 模式发送消息
 | 
	
		
			
				|  |  | +     * @throws InterruptedException
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      void t1() throws InterruptedException {
 | 
	
		
			
				|  |  |          for (int i = 0; i < 100; i++) {
 | 
	
	
		
			
				|  | @@ -30,24 +34,38 @@ class ProducerApplicationTests {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * fanout 模式发送消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      void t2(){
 | 
	
		
			
				|  |  |          rabbitTemplate.convertAndSend(
 | 
	
		
			
				|  |  |                  "com.lc.fanout.demo", "", "广播模式的消息发送" );
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * direct 模式发送消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      void t3(){
 | 
	
		
			
				|  |  |          rabbitTemplate.convertAndSend(
 | 
	
		
			
				|  |  |                  "com.lc.direct.demo", "北京", "晴转多云" );
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * direct 模式发送消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      void t4(){
 | 
	
		
			
				|  |  |          rabbitTemplate.convertAndSend(
 | 
	
		
			
				|  |  |                  "com.lc.direct.demo", "哈尔滨", "多云有雷阵雨" );
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 手工发送消息
 | 
	
		
			
				|  |  | +     * @throws IOException
 | 
	
		
			
				|  |  | +     * @throws TimeoutException
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  |      @Test
 | 
	
		
			
				|  |  |      void sendMsg() throws IOException, TimeoutException {
 | 
	
		
			
				|  |  |          //创建一个连接
 |