blob: f4c0281a89e6ce674aa1ca722c669c6b8816c71b [file] [log] [blame]
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
#include <memory>
#include <string>
#include "MQClient.h"
#include "MQMessage.h"
#include "MQMessageExt.h"
#include "SessionCredentials.h"
#include "TransactionListener.h"
#include "TransactionSendResult.h"
namespace rocketmq {
class TransactionMQProducerImpl;
class ROCKETMQCLIENT_API TransactionMQProducer {
TransactionMQProducer(const std::string& producerGroup);
virtual ~TransactionMQProducer();
void start();
void shutdown();
std::string version();
const std::string& getNamesrvAddr() const;
void setNamesrvAddr(const std::string& namesrvAddr);
const std::string& getNamesrvDomain() const;
void setNamesrvDomain(const std::string& namesrvDomain);
const std::string& getInstanceName() const;
void setInstanceName(const std::string& instanceName);
const std::string& getNameSpace() const;
void setNameSpace(const std::string& nameSpace);
const std::string& getGroupName() const;
void setGroupName(const std::string& groupname);
void setSessionCredentials(const std::string& accessKey,
const std::string& secretKey,
const std::string& accessChannel);
const SessionCredentials& getSessionCredentials() const;
void setUnitName(std::string unitName);
const std::string& getUnitName() const;
int getSendMsgTimeout() const;
void setSendMsgTimeout(int sendMsgTimeout);
void setTcpTransportPullThreadNum(int num);
int getTcpTransportPullThreadNum() const;
void setTcpTransportConnectTimeout(uint64_t timeout); // ms
uint64_t getTcpTransportConnectTimeout() const;
void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
uint64_t getTcpTransportTryLockTimeout() const;
int getCompressMsgBodyOverHowmuch() const;
void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch);
int getCompressLevel() const;
void setCompressLevel(int compressLevel);
int getMaxMessageSize() const;
void setMaxMessageSize(int maxMessageSize);
void setLogLevel(elogLevel inputLevel);
elogLevel getLogLevel();
void setLogFileSizeAndNum(int fileNum, long perFileSize); // perFileSize is MB unit
std::shared_ptr<TransactionListener> getTransactionListener();
void setTransactionListener(TransactionListener* listener);
TransactionSendResult sendMessageInTransaction(MQMessage& msg, void* arg);
void checkTransactionState(const std::string& addr,
const MQMessageExt& message,
long tranStateTableOffset,
long commitLogOffset,
const std::string& msgId,
const std::string& transactionId,
const std::string& offsetMsgId);
TransactionMQProducerImpl* impl;
} // namespace rocketmq