public class MQTransProducer extends MQProducer
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
groupId |
credentials, endpoint, instanceId, serviceClient, topicName, topicURL| 限定符 | 构造器和说明 |
|---|---|
protected |
MQTransProducer(String instanceId,
String topicName,
String groupId,
com.aliyun.mq.http.common.http.ServiceClient client,
com.aliyun.mq.http.common.auth.ServiceCredentials credentials,
URI endpoint) |
| 限定符和类型 | 方法和说明 |
|---|---|
AsyncResult<List<Message>> |
asyncConsumeHalfMessage(int num,
int pollingSecond,
AsyncCallback<List<Message>> callback)
consume half message to check transaction status, three choice:
commit(String) , rollback(String)
or do nothing (will get the message again after nextConsumeTime). |
void |
commit(String handle)
commit transaction msg, the consumer will receive the msg.
|
List<Message> |
consumeHalfMessage(int num,
int pollingSecond)
consume half message to check transaction status, three choice:
commit(String) , rollback(String)
or do nothing (after 10s will get the message again). |
void |
rollback(String handle)
rollback transaction msg, the consumer will not receive the msg.
|
String |
toString() |
asyncPublishMessage, checkMessage, getInstanceId, getTopicName, publishMessageprotected final String groupId
protected MQTransProducer(String instanceId, String topicName, String groupId, com.aliyun.mq.http.common.http.ServiceClient client, com.aliyun.mq.http.common.auth.ServiceCredentials credentials, URI endpoint)
instanceId, - instance idtopicName, - topic nameclient, - ServiceClient objectcredentials, - ServiceCredentials objectendpoint, - user mq http endpoint, ie: http://uid.mqrest.region.aliyuncs.com/public List<Message> consumeHalfMessage(int num, int pollingSecond) throws ServiceException, ClientException
commit(String) , rollback(String)
or do nothing (after 10s will get the message again).num - the count of messages consumed once
value: 1~16pollingSecond - if greater than 0, means the time(second) the request holden at server if there is no message to consume.
If less or equal 0, means the server will response back if there is no message to consume.
value: 1~30ServiceException - Exception from serverClientException - Exception from clientpublic AsyncResult<List<Message>> asyncConsumeHalfMessage(int num, int pollingSecond, AsyncCallback<List<Message>> callback)
commit(String) , rollback(String)
or do nothing (will get the message again after nextConsumeTime).num - the count of messages consumed once
value: 1~16pollingSecond - if greater than 0, means the time(second) the request holden at server if there is no message to consume.
If less or equal 0, means the server will response back if there is no message to consume.
value: 1~30callback, - user callback objectpublic void commit(String handle) throws ServiceException, ClientException
handle - msg handleServiceException - Exception from serverClientException - Exception from clientpublic void rollback(String handle) throws ServiceException, ClientException
handle - msg handleServiceException - Exception from serverClientException - Exception from clientpublic String toString()
toString 在类中 MQProducerCopyright © 2021. All Rights Reserved.