code: protected boolean putToQueue(IQueueMessage<ID, DATA> msg) {
          byte[] msgData = serialize(msg);
          Object pKey = msg instanceof IPartitionSupport ? ((IPartitionSupport) msg).getPartitionKey()
                  : msg.getId();
          if (pKey == null) {
              pKey = msg.getId();
          }
          KafkaMessage kMsg = pKey != null ? new KafkaMessage(topicName, pKey.toString(), msgData)
                  : new KafkaMessage(topicName, msgData);
          if (sendAsync) {
              return kafkaClient.sendMessageRaw(producerType, kMsg) != null;
          } else {
              return kafkaClient.sendMessage(producerType, kMsg) != null;
          }
      }
docs: Puts a message to Kafka queue, partitioning message by
  {@link IQueueMessage#qId()}
  
  @param msg
  @return