You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2018/12/05 04:46:15 UTC

[GitHub] vongosling closed pull request #12: Add api docs for message, producer, push consumer

vongosling closed pull request #12: Add api docs for message, producer, push consumer
URL: https://github.com/apache/rocketmq-client-python/pull/12
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/doc/api-doc/consumer-push.md b/doc/api-doc/consumer-push.md
new file mode 100644
index 0000000..a783e47
--- /dev/null
+++ b/doc/api-doc/consumer-push.md
@@ -0,0 +1,80 @@
+----------
+## Api docs
+
+### 1. Push Consumer
+* consumer = CreatePushConsumer(consumerGroup) <br />
+  - function description<br />
+    create a push consumer instance, by setting consumer group<br />
+
+  - input <br />
+    consumerGroup: consumer group<br />
+    
+  - return<br />
+    consumer: consumer instance
+
+* SetPushConsumerNameServerAddress(consumer, namesrv) <br />
+  - function description<br />
+    set name srv address for the consumer instance<br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    namesrv: name srv address. like : 127.0.0.1:9876
+
+  - return : no<br />
+
+* Subscribe(consumer, topic, tag) <br />
+  - function description<br />
+    make consumer subscribe the topic and tag <br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    topic: topic name
+    tag: topic tag
+
+* RegisterMessageCallback(consumer, pyCallBack) <br />
+  - function description<br />
+    set callback for push consumer instance <br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    pyCallBack: py callback method. when message pulled, they would be send to a pyCallback method
+
+* SetPushConsumerThreadCount(consumer, threadCount)
+  - function description<br />
+    set push consumer thread count<br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    threadCount: thread count
+
+* SetPushConsumerMessageBatchMaxSize(consumer, batchSize)
+  - function description<br />
+    set message count for one push<br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    batchSize: message count 
+
+* SetPushConsumerInstanceName(consumer, instanceName)
+  - function description<br />
+    set consumer instance name<br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    instanceName: consumer instance name
+
+* SetPushConsumerSessionCredentials(consumer, accessKey, secretKey,channel)
+  - function description<br />
+    set consumer access keys<br />
+
+  - input <br />
+    consumer: consumer intance<br />
+    accessKey: accessKey<br />
+    secretKey: secretKey<br />
+    channel: channel<br />
+    
+
+
+
+
+
diff --git a/doc/api-doc/message.md b/doc/api-doc/message.md
new file mode 100644
index 0000000..b727a6d
--- /dev/null
+++ b/doc/api-doc/message.md
@@ -0,0 +1,135 @@
+----------
+## Api docs
+
+### 1. Message
+* message = CreateMessage("topicName") <br />
+  - function description<br />
+    create a message instance, by setting topic field<br />
+
+  - input <br />
+    topicName: a topic name<br />
+
+  - return<br />
+    a new message instance, after used it, you need call DestroyMessage(message)<br />
+
+* DestroyMessage(message) <br />
+  - function description<br />
+    destroy a message instance, delete memmory<br />
+
+  - input <br />
+    message: message instance<br />
+
+* SetMessageTopic(message, topic) <br />
+  - function description<br />
+    set topic field value for the message<br />
+
+  - input <br />
+    message: message instance<br />
+    topic: a topic name
+
+* SetMessageTags(message, tags) <br />
+  - function description<br />
+    set tag field value for the message<br />
+
+  - input <br />
+    message: message instance<br />
+    tags: tag for the topic
+
+* SetMessageKeys(message, keys) <br />
+  - function description<br />
+    set key field value for the message<br />
+
+  - input <br />
+    message: message instance<br />
+    keys: key for the topic
+
+* SetMessageBody(message, stringBody) <br />
+  - function description<br />
+    set body for the message<br />
+
+  - input <br />
+    message: message instance<br />
+    body: message body as string
+
+* SetByteMessageBody(message, byteBody, byteLength) <br />
+  - function description<br />
+    set body for the message<br />
+
+  - input <br />
+    message: message instance<br />
+    byteBody: message body as byte[]
+    byteLength: byteBody's length
+
+* SetMessageProperty(message, key, value) <br />
+  - function description<br />
+    set extend k-v for message<br />
+
+  - input <br />
+    message: message instance<br />
+    key: string key
+    value: string value
+
+* SetMessageDelayTimeLevel(message, level) <br />
+  - function description<br />
+    set delay level<br />
+
+  - input <br />
+    message: message instance<br />
+    level: delay level as int
+
+
+### 2. MessageExt
+* topic = GetMessageTopic(msgExt) <br />
+  - function description<br />
+    get topic name from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+  - return<br />
+    topic: topic name
+
+* tag = GetMessageTags(msgExt) <br />
+  - function description<br />
+    get tag from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+  - return<br />
+    tag: tag
+
+* key = GetMessageKeys(msgExt) <br />
+  - function description<br />
+    get message key from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+  - return<br />
+    key: message key
+
+* body = GetMessageBody(msgExt) <br />
+  - function description<br />
+    get message body from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+  - return<br />
+    body: message body as string
+
+* value = GetMessageProperty(msgExt, key) <br />
+  - function description<br />
+    get a message proprty value from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+    key: property key
+  - return<br />
+    value: property value as string
+
+* messageId = GetMessageId(msgExt) <br />
+  - function description<br />
+    get a message id from a message instance<br />
+
+  - input <br />
+    msgExt: message instance<br />
+  - return<br />
+    messageId: message id as string
\ No newline at end of file
diff --git a/doc/api-doc/producer.md b/doc/api-doc/producer.md
new file mode 100644
index 0000000..6af4c99
--- /dev/null
+++ b/doc/api-doc/producer.md
@@ -0,0 +1,94 @@
+----------
+## Api docs
+
+### Producer
+* producer = CreateProducer("producerName") <br />
+  - function description<br />
+    create a producer instance<br />
+
+  - input <br />
+    producerName: producer group name<br />
+
+  - return<br />
+    a new producer instance, can send messages<br />
+
+* SetProducerNameServerAddress(producer, "namesrv address")
+  - function description<br />
+    set namesrv address for the producer instance<br />
+
+  - input<br />
+    producer : a producer instance <br />
+
+    namesrv address : like 127.0.0.1:9876<br />
+  - return : no <br />
+* SetProducerInstanceName(producer, "instance name")
+  - function description<br />
+    set instance name for the producer
+
+  - input<br />
+    producer : a producer instance <br />
+    intance name : a producer instance name<br />
+  - return : no <br />
+    
+* SetProducerSessionCredentials(producer, accessKey, secretKey, channel)
+  - function description<br />
+    set access keys for accessing broker in the session
+
+  - input<br />
+    producer : a producer instance <br />
+    accessKey : accessKey<br />
+    secretKey : secretKey<br />
+    channel : channel<br />
+  - return : no <br />
+
+* StartProducer(producer)
+  - function description<br />
+    start the producer instance
+
+  - input<br />
+    producer : a producer instance <br />
+   
+  - return : no <br />
+
+* ShutdownProducer(producer)
+  - function description<br />
+    shutdown the producer instance
+
+  - input<br />
+    producer : a producer instance <br />
+   
+  - return : no <br />
+
+* DestroyProducer(producer)
+  - function description<br />
+    destroy the producer instance
+
+  - input<br />
+    producer : a producer instance <br />
+   
+  - return : no <br />
+
+* PySendResult result = SendMessageSync(producer, msg)
+  - function description<br />
+    send a message sync
+
+  - input<br />
+    producer : a producer instance <br />
+    msg : a message instance <br />
+    
+  - return<br />
+    result.GetMsgId(): if send successfuly, it is the message id<br />
+    result.offset : message offset in broker<br />
+    result.sendStatus<br />
+      SEND_OK: <br />
+      SEND_FLUSH_DISK_TIMEOUT,<br />
+      SEND_FLUSH_SLAVE_TIMEOUT,<br />
+      SEND_SLAVE_NOT_AVAILABLE<br />
+
+* SendMessageOneway(producer, msg)
+  - function description<br />
+    send a message one way, no matter about the result
+
+  - input<br />
+    producer : a producer instance <br />
+    msg : a message instance <br />
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services