basicPublish方法主要是对消息进行一些设置,主要讲basicproperties的相关内容
private String contentType; // 消息的内容类型
private String contentEncoding; // 消息内容的编码
private Map<String, Object> headers; // 消息的头
private Integer deliveryMode; // 消息是否持久化,1为否,2为是
private Integer priority; // 消息的优先级
private String correlationId; // 关联id
private String replyTo; // 消息回复的队列名称
private String expiration; // 消息的有效时间
private String messageId; // 消息的id
private Date timestamp; // 消息的时间戳
private String type; // 类型
private String userId; // 用户id
private String appId; // 应用id
private String clusterId; // 集群id
MessageProperties对一些常用的进行了设置,共有6个
public static final BasicProperties MINIMAL_BASIC = new BasicProperties((String)null, (String)null, (Map)null, (Integer)null, (Integer)null, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);
public static final BasicProperties MINIMAL_PERSISTENT_BASIC = new BasicProperties((String)null, (String)null, (Map)null, 2, (Integer)null, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);
public static final BasicProperties BASIC = new BasicProperties("application/octet-stream", (String)null, (Map)null, 1, 0, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);
public static final BasicProperties PERSISTENT_BASIC = new BasicProperties("application/octet-stream", (String)null, (Map)null, 2, 0, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);
public static final BasicProperties TEXT_PLAIN = new BasicProperties("text/plain", (String)null, (Map)null, 1, 0, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);
public static final BasicProperties PERSISTENT_TEXT_PLAIN = new BasicProperties("text/plain", (String)null, (Map)null, 2, 0, (String)null, (String)null, (String)null, (String)null, (Date)null, (String)null, (String)null, (String)null, (String)null);