BaseListener.java 451 B

123456789101112131415161718
  1. package yike.example.mq;
  2. import com.alibaba.fastjson.JSONObject;
  3. public class BaseListener {
  4. protected final String QUEUE_NAME = ".QUEUE";
  5. protected String addExchangeAndRoutingKey(Object content, String exchange, String routingKey) {
  6. JSONObject jsonObject = new JSONObject();
  7. jsonObject.put("routingKey", routingKey);
  8. jsonObject.put("content", content);
  9. jsonObject.put("exchange", exchange);
  10. return jsonObject.toJSONString();
  11. }
  12. }