amqp的消息属性处理类--MessagePostProcessor

@Component
public class TenantMessageProcessor implements MessagePostProcessor {

	@Autowired
	private TenantIdentifierResolver currentTenantIdentifierResolver;

	@Override
	public Message postProcessMessage(Message message) throws AmqpException {
		String tenantId = currentTenantIdentifierResolver.resolveCurrentTenantIdentifier();
		message.getMessageProperties().getHeaders().put("tenantId", tenantId);
		return message;
	}

}

posted @ 2018-03-25 09:43  車輪の唄  阅读(17)  评论(0编辑  收藏  举报  来源