Api docs

Producer

  • producer = CreateProducer(“producerName”)

    • function description
      create a producer instance

    • input
      producerName: producer group name

    • return
      a new producer instance, can send messages

  • SetProducerNameServerAddress(producer, “namesrv address”)

    • function description
      set namesrv address for the producer instance

    • input
      producer : a producer instance

      namesrv address : like 127.0.0.1:9876

    • return : no

  • SetProducerInstanceName(producer, “instance name”)

    • function description
      set instance name for the producer

    • input
      producer : a producer instance
      intance name : a producer instance name

    • return : no

  • SetProducerSessionCredentials(producer, accessKey, secretKey, channel)

    • function description
      set access keys for accessing broker in the session

    • input
      producer : a producer instance
      accessKey : accessKey
      secretKey : secretKey
      channel : channel

    • return : no

  • StartProducer(producer)

    • function description
      start the producer instance

    • input
      producer : a producer instance

    • return : no

  • ShutdownProducer(producer)

    • function description
      shutdown the producer instance

    • input
      producer : a producer instance

    • return : no

  • DestroyProducer(producer)

    • function description
      destroy the producer instance

    • input
      producer : a producer instance

    • return : no

  • PySendResult result = SendMessageSync(producer, msg)

    • function description
      send a message sync

    • input
      producer : a producer instance
      msg : a message instance

    • return
      result.GetMsgId(): if send successfuly, it is the message id
      result.offset : message offset in broker
      result.sendStatus
      SEND_OK:
      SEND_FLUSH_DISK_TIMEOUT,
      SEND_FLUSH_SLAVE_TIMEOUT,
      SEND_SLAVE_NOT_AVAILABLE

  • SendMessageOneway(producer, msg)

    • function description
      send a message one way, no matter about the result

    • input
      producer : a producer instance
      msg : a message instance

  • SendMessageOrderly(producer, msg, autoRetryTimes,arg, queueSelectorCallback)

    • function description
      send a message orderly

    • input
      producer : a producer instance
      msg : a message instance
      autoRetryTimes: retry times when send fail
      arg: send args
      queueSelectorCallback: callback for which queue choose to send message to. return queue index start from 0 to (max queue count -1)