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;
}
}