ReceiveService { public void sendMessageToMQ(final Map<String, Object> map){ for (final Entry<String, Object> entry : map.entrySet()) { Runnable worker = new Runnable() { public void run() { messageService.sendObject(entry.getKey().toString(), entry.getValue()); } }; reciveExecutor.execute(worker); } }  void sendMessage(final Object data); void sendMessageToMQ(final Map<String, Object> map);  }
@Test public void testSendMessageToMQ() { Map<String, Object> paraMap = Maps.newHashMap(); int i = 0; while(true) { UserGoodsOrderDetailVo u = new UserGoodsOrderDetailVo(); u.setGoodsName("云主机"+i); u.setGoodsBuyLong("1.00"); u.setGoodsMoney("2000.00"); u.setAddShopCartDateTime(new Date().toString()); paraMap.put("goodsBuyQueue", u); receiveService.sendMessageToMQ(paraMap); paraMap.clear(); i++; try { Thread.sleep(1000*2); } catch (InterruptedException e) { e.printStackTrace(); } } }