You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2019/07/30 09:38:47 UTC
[rocketmq-ons-cpp] 20/35: Add lesence header
This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-ons-cpp.git
commit b53e4c307efbeb4f60d4db4b9b0733ad632527e6
Author: ShannonDing <li...@163.com>
AuthorDate: Wed Jul 24 21:08:33 2019 +0800
Add lesence header
---
src/main/c/native/rocketmq.h | 17 ++
src/main/cpp/benchmark/ExampleBenchmark.cpp | 25 ++-
src/main/cpp/benchmark/ProducerBenchmark.cpp | 21 ++-
src/main/cpp/demos/ConsumerDemo.cpp | 17 ++
src/main/cpp/demos/MultiThreadProducerDemo.cpp | 17 ++
src/main/cpp/demos/OrderConsumerDemo.cpp | 17 ++
src/main/cpp/demos/OrderProducerDemo.cpp | 17 ++
src/main/cpp/demos/ProducerAsyncDemo.cpp | 17 ++
src/main/cpp/demos/ProducerDemo.cpp | 17 ++
src/main/cpp/demos/ProducerOnewayDemo.cpp | 17 ++
src/main/cpp/demos/TransactionProducerDemo.cpp | 18 +-
src/main/cpp/include/Action.h | 27 ++-
src/main/cpp/include/ConsumeContext.h | 29 ++-
src/main/cpp/include/ConsumeOrderContext.h | 29 ++-
src/main/cpp/include/LocalTransactionChecker.h | 31 +++-
src/main/cpp/include/LocalTransactionExecuter.h | 31 +++-
src/main/cpp/include/Message.h | 219 +++++++++++++---------
src/main/cpp/include/MessageListener.h | 32 +++-
src/main/cpp/include/MessageOrderListener.h | 34 +++-
src/main/cpp/include/MessageQueueONS.h | 64 +++++--
src/main/cpp/include/MessageQueueSelectorONS.h | 30 ++-
src/main/cpp/include/ONSCallback.h | 23 ++-
src/main/cpp/include/ONSChannel.h | 17 ++
src/main/cpp/include/ONSClient.h | 17 ++
src/main/cpp/include/ONSClientException.h | 48 +++--
src/main/cpp/include/ONSFactory.h | 232 +++++++++++++++---------
src/main/cpp/include/OrderAction.h | 25 ++-
src/main/cpp/include/OrderConsumer.h | 38 +++-
src/main/cpp/include/OrderProducer.h | 41 +++--
src/main/cpp/include/Producer.h | 65 ++++---
src/main/cpp/include/PullConsumer.h | 78 +++++---
src/main/cpp/include/PullResultONS.h | 75 +++++---
src/main/cpp/include/PushConsumer.h | 42 +++--
src/main/cpp/include/SendResultONS.h | 39 +++-
src/main/cpp/include/TransactionProducer.h | 17 ++
src/main/cpp/include/TransactionStatus.h | 27 ++-
src/main/cpp/sdk/ClientBase.cpp | 17 ++
src/main/cpp/sdk/ClientBase.h | 17 ++
src/main/cpp/sdk/ConsumerImpl.cpp | 17 ++
src/main/cpp/sdk/ConsumerImpl.h | 40 +++-
src/main/cpp/sdk/Message.cpp | 17 ++
src/main/cpp/sdk/MessageQueueONS.cpp | 17 ++
src/main/cpp/sdk/ONSClientException.cpp | 25 ++-
src/main/cpp/sdk/ONSFactory.cpp | 64 ++++---
src/main/cpp/sdk/OrderConsumerImpl.cpp | 23 ++-
src/main/cpp/sdk/OrderConsumerImpl.h | 34 +++-
src/main/cpp/sdk/OrderProducerImpl.cpp | 19 +-
src/main/cpp/sdk/OrderProducerImpl.h | 19 +-
src/main/cpp/sdk/ProducerImpl.cpp | 17 ++
src/main/cpp/sdk/ProducerImpl.h | 17 ++
src/main/cpp/sdk/RocketMQClient.h | 17 ++
src/main/cpp/sdk/SendResultONS.cpp | 16 ++
src/main/cpp/sdk/TransactionProducerImpl.cpp | 17 ++
src/main/cpp/sdk/TransactionProducerImpl.h | 17 ++
src/main/cpp/sdk/common/Common.h | 17 ++
src/main/cpp/sdk/common/Logger.cpp | 18 +-
src/main/cpp/sdk/common/Logger.h | 17 ++
src/main/cpp/sdk/common/ONSClientAbstract.cpp | 17 ++
src/main/cpp/sdk/common/ONSClientAbstract.h | 17 ++
src/main/cpp/sdk/common/UtilAll.cpp | 17 ++
src/main/cpp/sdk/common/UtilAll.h | 26 ++-
61 files changed, 1611 insertions(+), 438 deletions(-)
diff --git a/src/main/c/native/rocketmq.h b/src/main/c/native/rocketmq.h
index ad48a98..e4385e4 100644
--- a/src/main/c/native/rocketmq.h
+++ b/src/main/c/native/rocketmq.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ROCKETMQ_H__
#define __ROCKETMQ_H__
#ifdef __cplusplus
diff --git a/src/main/cpp/benchmark/ExampleBenchmark.cpp b/src/main/cpp/benchmark/ExampleBenchmark.cpp
index 383628c..a097c9b 100644
--- a/src/main/cpp/benchmark/ExampleBenchmark.cpp
+++ b/src/main/cpp/benchmark/ExampleBenchmark.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <benchmark/benchmark.h>
#include <atomic>
@@ -29,7 +46,11 @@ static void BM_simpleLoopSeq(benchmark::State &state) {
}
}
-BENCHMARK(BM_simpleLoopRelaxed)->RangeMultiplier(2)->Range(1, 1<<10)->UseRealTime()->Unit(benchmark::kNanosecond);
-BENCHMARK(BM_simpleLoopSeq)->RangeMultiplier(2)->Range(1, 1<<10)->UseRealTime()->Unit(benchmark::kNanosecond);
+BENCHMARK(BM_simpleLoopRelaxed)
+->RangeMultiplier(2)->Range(1, 1<<10)->UseRealTime()->
+Unit(benchmark::kNanosecond);
+BENCHMARK(BM_simpleLoopSeq)
+->RangeMultiplier(2)->Range(1, 1<<10)->UseRealTime()->
+Unit(benchmark::kNanosecond);
BENCHMARK_MAIN();
\ No newline at end of file
diff --git a/src/main/cpp/benchmark/ProducerBenchmark.cpp b/src/main/cpp/benchmark/ProducerBenchmark.cpp
index 4300540..35dc0df 100644
--- a/src/main/cpp/benchmark/ProducerBenchmark.cpp
+++ b/src/main/cpp/benchmark/ProducerBenchmark.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <benchmark/benchmark.h>
#include "rocketmq.h"
#include "rocketmq-ons-cpp-full.h"
@@ -35,6 +52,8 @@ static void BM_ProducerSendMessage(benchmark::State &state) {
graal_detach_thread(thread_);
}
-BENCHMARK(BM_ProducerSendMessage)->RangeMultiplier(2)->Range(1<<6, 1<<10)->UseRealTime()->Unit(benchmark::kMillisecond);
+BENCHMARK(BM_ProducerSendMessage)
+->RangeMultiplier(2)->Range(1<<6, 1<<10)->UseRealTime()->
+Unit(benchmark::kMillisecond);
BENCHMARK_MAIN();
diff --git a/src/main/cpp/demos/ConsumerDemo.cpp b/src/main/cpp/demos/ConsumerDemo.cpp
index 0df672a..407ef1e 100644
--- a/src/main/cpp/demos/ConsumerDemo.cpp
+++ b/src/main/cpp/demos/ConsumerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ONSFactory.h"
#include <iostream>
diff --git a/src/main/cpp/demos/MultiThreadProducerDemo.cpp b/src/main/cpp/demos/MultiThreadProducerDemo.cpp
index 867a736..9704ecf 100644
--- a/src/main/cpp/demos/MultiThreadProducerDemo.cpp
+++ b/src/main/cpp/demos/MultiThreadProducerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include <thread>
diff --git a/src/main/cpp/demos/OrderConsumerDemo.cpp b/src/main/cpp/demos/OrderConsumerDemo.cpp
index 28f5ee5..a146a80 100644
--- a/src/main/cpp/demos/OrderConsumerDemo.cpp
+++ b/src/main/cpp/demos/OrderConsumerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ONSFactory.h"
#include <iostream>
diff --git a/src/main/cpp/demos/OrderProducerDemo.cpp b/src/main/cpp/demos/OrderProducerDemo.cpp
index 6bf6ed4..65ac634 100644
--- a/src/main/cpp/demos/OrderProducerDemo.cpp
+++ b/src/main/cpp/demos/OrderProducerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include "ONSFactory.h"
diff --git a/src/main/cpp/demos/ProducerAsyncDemo.cpp b/src/main/cpp/demos/ProducerAsyncDemo.cpp
index 451ab8a..337c694 100644
--- a/src/main/cpp/demos/ProducerAsyncDemo.cpp
+++ b/src/main/cpp/demos/ProducerAsyncDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include <mutex>
diff --git a/src/main/cpp/demos/ProducerDemo.cpp b/src/main/cpp/demos/ProducerDemo.cpp
index 0b19174..73e0e41 100644
--- a/src/main/cpp/demos/ProducerDemo.cpp
+++ b/src/main/cpp/demos/ProducerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include "ONSFactory.h"
diff --git a/src/main/cpp/demos/ProducerOnewayDemo.cpp b/src/main/cpp/demos/ProducerOnewayDemo.cpp
index 031bff3..890f1fb 100644
--- a/src/main/cpp/demos/ProducerOnewayDemo.cpp
+++ b/src/main/cpp/demos/ProducerOnewayDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include "ONSFactory.h"
diff --git a/src/main/cpp/demos/TransactionProducerDemo.cpp b/src/main/cpp/demos/TransactionProducerDemo.cpp
index 6044589..420afef 100644
--- a/src/main/cpp/demos/TransactionProducerDemo.cpp
+++ b/src/main/cpp/demos/TransactionProducerDemo.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <iostream>
#include <chrono>
#include "ONSFactory.h"
@@ -22,7 +39,6 @@ class LocalTransactionExecuterImpl : public LocalTransactionExecuter {
}
};
-
int main() {
std::cout << "=======Before sending message=======" << std::endl;
ONSFactoryProperty factoryInfo;
diff --git a/src/main/cpp/include/Action.h b/src/main/cpp/include/Action.h
index 289f440..6a3f708 100644
--- a/src/main/cpp/include/Action.h
+++ b/src/main/cpp/include/Action.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ACTION_H__
#define __ACTION_H__
@@ -5,10 +22,10 @@
// consuming result
enum Action {
- // consume success, application could continue to consume next message
- CommitMessage,
- // consume fail, server will deliver this message later, application could
- // continue to consume next message
- ReconsumeLater
+ // consume success, application could continue to consume next message
+ CommitMessage,
+ // consume fail, server will deliver this message later, application could
+ // continue to consume next message
+ ReconsumeLater
};
#endif
diff --git a/src/main/cpp/include/ConsumeContext.h b/src/main/cpp/include/ConsumeContext.h
index abb59de..2887160 100644
--- a/src/main/cpp/include/ConsumeContext.h
+++ b/src/main/cpp/include/ConsumeContext.h
@@ -1,13 +1,32 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __CONSUMECONTEXT_H__
#define __CONSUMECONTEXT_H__
+
#include "ONSClient.h"
namespace ons {
-class ONSCLIENT_API ConsumeContext {
- public:
- ConsumeContext() {}
- virtual ~ConsumeContext() {}
-};
+ class ONSCLIENT_API ConsumeContext {
+ public:
+ ConsumeContext() {}
+
+ virtual ~ConsumeContext() {}
+ };
}
#endif
diff --git a/src/main/cpp/include/ConsumeOrderContext.h b/src/main/cpp/include/ConsumeOrderContext.h
index a196d5d..6915982 100644
--- a/src/main/cpp/include/ConsumeOrderContext.h
+++ b/src/main/cpp/include/ConsumeOrderContext.h
@@ -1,13 +1,32 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __CONSUMEORDERLYCONTEXT_H__
#define __CONSUMEORDERLYCONTEXT_H__
+
#include "ONSClient.h"
namespace ons {
-class ONSCLIENT_API ConsumeOrderContext {
- public:
- ConsumeOrderContext() {}
- virtual ~ConsumeOrderContext() {}
-};
+ class ONSCLIENT_API ConsumeOrderContext {
+ public:
+ ConsumeOrderContext() {}
+
+ virtual ~ConsumeOrderContext() {}
+ };
}
#endif
diff --git a/src/main/cpp/include/LocalTransactionChecker.h b/src/main/cpp/include/LocalTransactionChecker.h
index 8601671..8972965 100644
--- a/src/main/cpp/include/LocalTransactionChecker.h
+++ b/src/main/cpp/include/LocalTransactionChecker.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __LOCALTRANSACTIONCHECKER_H__
#define __LOCALTRANSACTIONCHECKER_H__
@@ -5,12 +22,14 @@
#include "TransactionStatus.h"
namespace ons {
-class LocalTransactionChecker {
- public:
- LocalTransactionChecker() {}
- virtual TransactionStatus check(Message& msg) = 0;
- virtual ~LocalTransactionChecker() {}
-};
+ class LocalTransactionChecker {
+ public:
+ LocalTransactionChecker() {}
+
+ virtual TransactionStatus check(Message &msg) = 0;
+
+ virtual ~LocalTransactionChecker() {}
+ };
}
#endif
diff --git a/src/main/cpp/include/LocalTransactionExecuter.h b/src/main/cpp/include/LocalTransactionExecuter.h
index 1d7ea4f..faa3389 100644
--- a/src/main/cpp/include/LocalTransactionExecuter.h
+++ b/src/main/cpp/include/LocalTransactionExecuter.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __LOCALTRANSACTIONEXECUTER_H__
#define __LOCALTRANSACTIONEXECUTER_H__
@@ -5,12 +22,14 @@
#include "TransactionStatus.h"
namespace ons {
-class LocalTransactionExecuter {
- public:
- LocalTransactionExecuter() {}
- virtual TransactionStatus execute(Message& msg) = 0;
- virtual ~LocalTransactionExecuter() {}
-};
+ class LocalTransactionExecuter {
+ public:
+ LocalTransactionExecuter() {}
+
+ virtual TransactionStatus execute(Message &msg) = 0;
+
+ virtual ~LocalTransactionExecuter() {}
+ };
}
#endif
diff --git a/src/main/cpp/include/Message.h b/src/main/cpp/include/Message.h
index 8038e29..341e3a0 100755
--- a/src/main/cpp/include/Message.h
+++ b/src/main/cpp/include/Message.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __MESSAGE_H__
#define __MESSAGE_H__
@@ -8,93 +25,121 @@
namespace ons {
-class SystemPropKey {
- public:
- SystemPropKey() {}
- ~SystemPropKey() {}
- static const char* TAG;
- static const char* KEY;
- static const char* MSGID;
- static const char* RECONSUMETIMES;
- static const char* STARTDELIVERTIME;
-};
-
-class ONSCLIENT_API Message {
- public:
- Message();
- Message(const std::string& topic, const std::string& tags, const std::string& byte_body);
- Message(const char* topic, const char* tags, const char* byte_body);
- Message(const char* topic, size_t topic_size, const char* tags, size_t tags_size, const char* body, size_t body_size);
- Message(const char* topic, const char* tags, const char* keys, const char* body);
-
- virtual ~Message();
-
- Message(const Message& other);
- Message& operator=(const Message& other);
-
- // userProperties was used to save user specific parameters which doesn't
- // belong to SystemPropKey
- void putUserProperties(const char* key, const char* value);
- const char* getUserProperties(const char* key) const;
- void setUserProperties(std::map<std::string, std::string>& userProperty);
- std::map<std::string, std::string> getUserProperties() const;
-
- // systemProperties only save parameters defined in SystemPropKey, please do
- // not add other parameters into systemProperties, else it was not saved.
- void putSystemProperties(const char* key, const char* value);
- const char* getSystemProperties(const char* key) const;
- void setSystemProperties(std::map<std::string, std::string>& systemProperty);
- std::map<std::string, std::string> getSystemProperties() const;
-
- const char* getTopic() const;
- void setTopic(const char* topic);
-
- const char* getTag() const;
- void setTag(const char* tags);
-
- const char* getKey() const;
- void setKey(const char* keys);
-
- const char* getMsgID() const;
- void setMsgID(const char* msgId);
-
- const long long getStartDeliverTime() const;
- void setStartDeliverTime(long long level);
-
- const char* getBody() const;
- const char* getByteBody(int *len) const;
- const std::string getMsgBody() const;
- const size_t getBodySize() const;
- void setMsgBody(const std::string msgbody);
- void setBody(unsigned char* byte_msgbody, int len);
-
- const int getReconsumeTimes() const;
- void setReconsumeTimes(int reconsumeTimes);
-
- long long getStoreTimestamp() const;
- void setStoreTimestamp(long long storeTimestamp);
-
- const std::string toString() const;
-
- const std::string toSystemString() const;
-
- const std::string toUserString() const;
-
- long long getQueueOffset() const;
- void setQueueOffset(long long queueOffset);
- protected:
- void Init(const std::string& topic, const std::string& tags,
- const std::string& keys, const std::string& body);
-
- private:
- std::string topic;
- std::string body;
- size_t body_size;
- long long m_storeTimestamp;
- long long m_queueOffset;
- std::map<std::string, std::string> systemProperties;
- std::map<std::string, std::string> userProperties;
-};
+ class SystemPropKey {
+ public:
+ SystemPropKey() {}
+
+ ~SystemPropKey() {}
+
+ static const char *TAG;
+ static const char *KEY;
+ static const char *MSGID;
+ static const char *RECONSUMETIMES;
+ static const char *STARTDELIVERTIME;
+ };
+
+ class ONSCLIENT_API Message {
+ public:
+ Message();
+
+ Message(const std::string &topic, const std::string &tags, const std::string &byte_body);
+
+ Message(const char *topic, const char *tags, const char *byte_body);
+
+ Message(const char *topic, size_t topic_size, const char *tags, size_t tags_size, const char *body,
+ size_t body_size);
+
+ Message(const char *topic, const char *tags, const char *keys, const char *body);
+
+ virtual ~Message();
+
+ Message(const Message &other);
+
+ Message &operator=(const Message &other);
+
+ // userProperties was used to save user specific parameters which doesn't
+ // belong to SystemPropKey
+ void putUserProperties(const char *key, const char *value);
+
+ const char *getUserProperties(const char *key) const;
+
+ void setUserProperties(std::map<std::string, std::string> &userProperty);
+
+ std::map<std::string, std::string> getUserProperties() const;
+
+ // systemProperties only save parameters defined in SystemPropKey, please do
+ // not add other parameters into systemProperties, else it was not saved.
+ void putSystemProperties(const char *key, const char *value);
+
+ const char *getSystemProperties(const char *key) const;
+
+ void setSystemProperties(std::map<std::string, std::string> &systemProperty);
+
+ std::map<std::string, std::string> getSystemProperties() const;
+
+ const char *getTopic() const;
+
+ void setTopic(const char *topic);
+
+ const char *getTag() const;
+
+ void setTag(const char *tags);
+
+ const char *getKey() const;
+
+ void setKey(const char *keys);
+
+ const char *getMsgID() const;
+
+ void setMsgID(const char *msgId);
+
+ const long long getStartDeliverTime() const;
+
+ void setStartDeliverTime(long long level);
+
+ const char *getBody() const;
+
+ const char *getByteBody(int *len) const;
+
+ const std::string getMsgBody() const;
+
+ const size_t getBodySize() const;
+
+ void setMsgBody(const std::string msgbody);
+
+ void setBody(unsigned char *byte_msgbody, int len);
+
+ const int getReconsumeTimes() const;
+
+ void setReconsumeTimes(int reconsumeTimes);
+
+ long long getStoreTimestamp() const;
+
+ void setStoreTimestamp(long long storeTimestamp);
+
+ const std::string toString() const;
+
+ const std::string toSystemString() const;
+
+ const std::string toUserString() const;
+
+ long long getQueueOffset() const;
+
+ void setQueueOffset(long long queueOffset);
+
+ protected:
+ void Init(const std::string &topic, const std::string &tags,
+ const std::string &keys, const std::string &body);
+
+ private:
+ std::string topic;
+ std::string body;
+ size_t body_size;
+ long long m_storeTimestamp;
+ long long m_queueOffset;
+ std::map<std::string, std::string> systemProperties;
+ std::map<std::string, std::string> userProperties;
+ };
} //<!end namespace;
#endif
diff --git a/src/main/cpp/include/MessageListener.h b/src/main/cpp/include/MessageListener.h
index 5733d2f..ff34742 100644
--- a/src/main/cpp/include/MessageListener.h
+++ b/src/main/cpp/include/MessageListener.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __MESSAGELISTENER_H__
#define __MESSAGELISTENER_H__
@@ -7,13 +24,14 @@
namespace ons {
-class ONSCLIENT_API MessageListener {
- public:
- MessageListener() {}
- virtual ~MessageListener() {}
+ class ONSCLIENT_API MessageListener {
+ public:
+ MessageListener() {}
+
+ virtual ~MessageListener() {}
- // interface of consuming message, should be realized by application
- virtual Action consume(Message& message, ConsumeContext& context) = 0;
-};
+ // interface of consuming message, should be realized by application
+ virtual Action consume(Message &message, ConsumeContext &context) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/MessageOrderListener.h b/src/main/cpp/include/MessageOrderListener.h
index 848dd20..7c6d5f1 100644
--- a/src/main/cpp/include/MessageOrderListener.h
+++ b/src/main/cpp/include/MessageOrderListener.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __MESSAGEORDERLYLISTENER_H__
#define __MESSAGEORDERLYLISTENER_H__
@@ -7,14 +24,15 @@
namespace ons {
-class MessageOrderListener {
- public:
- MessageOrderListener() {}
- virtual ~MessageOrderListener() {}
+ class MessageOrderListener {
+ public:
+ MessageOrderListener() {}
+
+ virtual ~MessageOrderListener() {}
- // interface of consuming message, should be realized by application
- virtual OrderAction consume(Message& message,
- ConsumeOrderContext& context) = 0;
-};
+ // interface of consuming message, should be realized by application
+ virtual OrderAction consume(Message &message,
+ ConsumeOrderContext &context) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/MessageQueueONS.h b/src/main/cpp/include/MessageQueueONS.h
index bd8a8dc..63ad0d5 100755
--- a/src/main/cpp/include/MessageQueueONS.h
+++ b/src/main/cpp/include/MessageQueueONS.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __MESSAGEQUEUEONS_H__
#define __MESSAGEQUEUEONS_H__
@@ -8,32 +25,39 @@
using namespace std;
namespace ons {
-class MessageQueueONS {
- public:
- MessageQueueONS();
- MessageQueueONS(const string& topic, const string& brokerName, int queueId);
+ class MessageQueueONS {
+ public:
+ MessageQueueONS();
+
+ MessageQueueONS(const string &topic, const string &brokerName, int queueId);
+
+ MessageQueueONS(const MessageQueueONS &other);
+
+ MessageQueueONS &operator=(const MessageQueueONS &other);
+
+ string getTopic() const;
+
+ void setTopic(const string &topic);
+
+ string getBrokerName() const;
+
+ void setBrokerName(const string &brokerName);
- MessageQueueONS(const MessageQueueONS& other);
- MessageQueueONS& operator=(const MessageQueueONS& other);
+ int getQueueId() const;
- string getTopic() const;
- void setTopic(const string& topic);
+ void setQueueId(int queueId);
- string getBrokerName() const;
- void setBrokerName(const string& brokerName);
+ bool operator==(const MessageQueueONS &mq) const;
- int getQueueId() const;
- void setQueueId(int queueId);
+ bool operator<(const MessageQueueONS &mq) const;
- bool operator==(const MessageQueueONS& mq) const;
- bool operator<(const MessageQueueONS& mq) const;
- int compareTo(const MessageQueueONS& mq) const;
+ int compareTo(const MessageQueueONS &mq) const;
- private:
- string m_topic;
- string m_brokerName;
- int m_queueId;
-};
+ private:
+ string m_topic;
+ string m_brokerName;
+ int m_queueId;
+ };
} //<!end namespace;
#endif
diff --git a/src/main/cpp/include/MessageQueueSelectorONS.h b/src/main/cpp/include/MessageQueueSelectorONS.h
index a82a285..6857bdd 100644
--- a/src/main/cpp/include/MessageQueueSelectorONS.h
+++ b/src/main/cpp/include/MessageQueueSelectorONS.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef _MESSAGEQUEUESELECTOR_H_
#define _MESSAGEQUEUESELECTOR_H_
@@ -6,12 +23,13 @@
namespace ons {
-class MessageQueueSelectorONS {
- public:
- virtual ~MessageQueueSelectorONS() {}
- virtual MessageQueueONS select(const vector<MessageQueueONS>& mqs,
- const Message& msg, void* arg) = 0;
-};
+ class MessageQueueSelectorONS {
+ public:
+ virtual ~MessageQueueSelectorONS() {}
+
+ virtual MessageQueueONS select(const vector<MessageQueueONS> &mqs,
+ const Message &msg, void *arg) = 0;
+ };
} //<!end namespace;
#endif //<! _MQSELECTOR_H_
diff --git a/src/main/cpp/include/ONSCallback.h b/src/main/cpp/include/ONSCallback.h
index d529426..fdd53bc 100644
--- a/src/main/cpp/include/ONSCallback.h
+++ b/src/main/cpp/include/ONSCallback.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ONSCALLBACK_H__
#define __ONSCALLBACK_H__
@@ -8,8 +25,10 @@ namespace ons {
class SendCallbackONS {
public:
virtual ~SendCallbackONS() {}
- virtual void onSuccess(SendResultONS& sendResult) {};
- virtual void onException(ONSClientException& e) {};
+
+ virtual void onSuccess(SendResultONS &sendResult) {};
+
+ virtual void onException(ONSClientException &e) {};
};
} // end of namespace SendResultONS
diff --git a/src/main/cpp/include/ONSChannel.h b/src/main/cpp/include/ONSChannel.h
index 6f538af..40a9831 100644
--- a/src/main/cpp/include/ONSChannel.h
+++ b/src/main/cpp/include/ONSChannel.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ONSCHANNEL_H__
#define __ONSCHANNEL_H__
diff --git a/src/main/cpp/include/ONSClient.h b/src/main/cpp/include/ONSClient.h
index 4ebc595..b9dab0b 100644
--- a/src/main/cpp/include/ONSClient.h
+++ b/src/main/cpp/include/ONSClient.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ONSCLIENT_H__
#define __ONSCLIENT_H__
diff --git a/src/main/cpp/include/ONSClientException.h b/src/main/cpp/include/ONSClientException.h
index 76922f3..10fca70 100644
--- a/src/main/cpp/include/ONSClientException.h
+++ b/src/main/cpp/include/ONSClientException.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ONSCLIENTEXCEPTION_H__
#define __ONSCLIENTEXCEPTION_H__
@@ -7,19 +24,24 @@
namespace ons {
-class ONSCLIENT_API ONSClientException : public std::exception {
- public:
- ONSClientException() throw();
- virtual ~ONSClientException() throw();
- ONSClientException(std::string msg, int error) throw();
- const char* GetMsg() const throw();
- const char* what() const throw();
- int GetError() const throw();
-
- private:
- std::string m_msg;
- int m_error;
-};
+ class ONSCLIENT_API ONSClientException : public std::exception {
+ public:
+ ONSClientException() throw();
+
+ virtual ~ONSClientException() throw();
+
+ ONSClientException(std::string msg, int error) throw();
+
+ const char *GetMsg() const throw();
+
+ const char *what() const throw();
+
+ int GetError() const throw();
+
+ private:
+ std::string m_msg;
+ int m_error;
+ };
}
#endif
diff --git a/src/main/cpp/include/ONSFactory.h b/src/main/cpp/include/ONSFactory.h
index ecb531a..2ff00c4 100755
--- a/src/main/cpp/include/ONSFactory.h
+++ b/src/main/cpp/include/ONSFactory.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ONSFACTORY_H_
#define __ONSFACTORY_H_
@@ -12,92 +29,133 @@
#include "TransactionProducer.h"
namespace ons {
-class ONSCLIENT_API ONSFactoryProperty {
- public:
- ONSFactoryProperty();
- virtual ~ONSFactoryProperty();
- bool checkValidityOfFactoryProperties(const std::string& key,
- const std::string& value) throw(ons::ONSClientException);
- const char* getLogPath() const;
- void setSendMsgTimeout(const int value);
- void setSendMsgRetryTimes(const int value);
- void setMaxMsgCacheSize(const int size);
- void setOnsTraceSwitch(bool onswitch);
- void setOnsChannel(ONSChannel onsChannel) throw(ons::ONSClientException);
- void setFactoryProperty(const char* key, const char* value) throw(ons::ONSClientException);
- void setFactoryProperties(std::map<std::string, std::string> factoryProperties);
- std::map<std::string, std::string> getFactoryProperties() const;
- const char* getProducerId() const;
- const char* getConsumerId() const;
- const char* getGroupId() const;
- const char* getPublishTopics() const;
- const char* getMessageModel() const;
- const int getSendMsgTimeout() const;
- const int getSendMsgRetryTimes() const;
- const int getConsumeThreadNums() const;
- const int getMaxMsgCacheSize() const;
- const ONSChannel getOnsChannel() const;
- const char* getChannel() const;
- const char* getMessageContent() const;
- const char* getNameSrvAddr() const;
- const char* getNameSrvDomain() const;
- const char* getAccessKey() const;
- const char* getSecretKey() const;
- const char* getConsumerInstanceName() const;
- bool getOnsTraceSwitch() const;
- const char* getInstanceId() const;
-
- public:
- static const char* LogPath;
- static const char* ProducerId;
- static const char* ConsumerId;
- static const char* GroupId;
- static const char* PublishTopics;
- static const char* MsgContent;
- static const char* ONSAddr;
- static const char* AccessKey;
- static const char* SecretKey;
- static const char* MessageModel;
- static const char* BROADCASTING;
- static const char* CLUSTERING;
- static const char* SendMsgTimeoutMillis;
- static const char* NAMESRV_ADDR;
- static const char* ConsumeThreadNums;
- static const char* OnsChannel;
- static const char* MaxMsgCacheSize;
- static const char* OnsTraceSwitch;
- static const char* SendMsgRetryTimes;
- static const char* ConsumerInstanceName;
- static const char* InstanceId;
-
- private:
- std::map<std::string, std::string> m_onsFactoryProperties;
-};
-
-class ONSCLIENT_API ONSFactoryAPI {
- public:
- ONSFactoryAPI();
- virtual ~ONSFactoryAPI();
-
- virtual ons::Producer* createProducer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
- virtual ons::OrderProducer* createOrderProducer(ons::ONSFactoryProperty factoryProperty) throw(
- ons::ONSClientException);
- virtual ons::OrderConsumer* createOrderConsumer(ons::ONSFactoryProperty factoryProperty) throw(
- ons::ONSClientException);
- virtual ons::TransactionProducer* createTransactionProducer(
- ons::ONSFactoryProperty factoryProperty, ons::LocalTransactionChecker* checker) throw(ons::ONSClientException);
- virtual ons::PullConsumer* createPullConsumer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
- virtual ons::PushConsumer* createPushConsumer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
-};
-
-class ONSCLIENT_API ONSFactory {
- public:
- virtual ~ONSFactory();
- static ons::ONSFactoryAPI* getInstance();
-
- private:
- ONSFactory();
- static ons::ONSFactoryAPI* onsFactoryInstance;
-};
+ class ONSCLIENT_API ONSFactoryProperty {
+ public:
+ ONSFactoryProperty();
+
+ virtual ~ONSFactoryProperty();
+
+ bool checkValidityOfFactoryProperties(const std::string &key,
+ const std::string &value) throw(ons::ONSClientException);
+
+ const char *getLogPath() const;
+
+ void setSendMsgTimeout(const int value);
+
+ void setSendMsgRetryTimes(const int value);
+
+ void setMaxMsgCacheSize(const int size);
+
+ void setOnsTraceSwitch(bool onswitch);
+
+ void setOnsChannel(ONSChannel onsChannel) throw(ons::ONSClientException);
+
+ void setFactoryProperty(const char *key, const char *value) throw(ons::ONSClientException);
+
+ void setFactoryProperties(std::map<std::string, std::string> factoryProperties);
+
+ std::map<std::string, std::string> getFactoryProperties() const;
+
+ const char *getProducerId() const;
+
+ const char *getConsumerId() const;
+
+ const char *getGroupId() const;
+
+ const char *getPublishTopics() const;
+
+ const char *getMessageModel() const;
+
+ const int getSendMsgTimeout() const;
+
+ const int getSendMsgRetryTimes() const;
+
+ const int getConsumeThreadNums() const;
+
+ const int getMaxMsgCacheSize() const;
+
+ const ONSChannel getOnsChannel() const;
+
+ const char *getChannel() const;
+
+ const char *getMessageContent() const;
+
+ const char *getNameSrvAddr() const;
+
+ const char *getNameSrvDomain() const;
+
+ const char *getAccessKey() const;
+
+ const char *getSecretKey() const;
+
+ const char *getConsumerInstanceName() const;
+
+ bool getOnsTraceSwitch() const;
+
+ const char *getInstanceId() const;
+
+ public:
+ static const char *LogPath;
+ static const char *ProducerId;
+ static const char *ConsumerId;
+ static const char *GroupId;
+ static const char *PublishTopics;
+ static const char *MsgContent;
+ static const char *ONSAddr;
+ static const char *AccessKey;
+ static const char *SecretKey;
+ static const char *MessageModel;
+ static const char *BROADCASTING;
+ static const char *CLUSTERING;
+ static const char *SendMsgTimeoutMillis;
+ static const char *NAMESRV_ADDR;
+ static const char *ConsumeThreadNums;
+ static const char *OnsChannel;
+ static const char *MaxMsgCacheSize;
+ static const char *OnsTraceSwitch;
+ static const char *SendMsgRetryTimes;
+ static const char *ConsumerInstanceName;
+ static const char *InstanceId;
+
+ private:
+ std::map<std::string, std::string> m_onsFactoryProperties;
+ };
+
+ class ONSCLIENT_API ONSFactoryAPI {
+ public:
+ ONSFactoryAPI();
+
+ virtual ~ONSFactoryAPI();
+
+ virtual ons::Producer *createProducer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
+
+ virtual ons::OrderProducer *createOrderProducer(ons::ONSFactoryProperty factoryProperty) throw(
+ ons::ONSClientException);
+
+ virtual ons::OrderConsumer *createOrderConsumer(ons::ONSFactoryProperty factoryProperty) throw(
+ ons::ONSClientException);
+
+ virtual ons::TransactionProducer *createTransactionProducer(
+ ons::ONSFactoryProperty factoryProperty,
+ ons::LocalTransactionChecker *checker) throw(ons::ONSClientException);
+
+ virtual ons::PullConsumer *
+ createPullConsumer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
+
+ virtual ons::PushConsumer *
+ createPushConsumer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException);
+ };
+
+ class ONSCLIENT_API ONSFactory {
+ public:
+ virtual ~ONSFactory();
+
+ static ons::ONSFactoryAPI *getInstance();
+
+ private:
+ ONSFactory();
+
+ static ons::ONSFactoryAPI *onsFactoryInstance;
+ };
} // namespace ons
#endif
diff --git a/src/main/cpp/include/OrderAction.h b/src/main/cpp/include/OrderAction.h
index 297d285..6cfa574 100644
--- a/src/main/cpp/include/OrderAction.h
+++ b/src/main/cpp/include/OrderAction.h
@@ -1,11 +1,28 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ORDERACTION_H__
#define __ORDERACTION_H__
// order consuming result
enum OrderAction {
- // consume success, application could continue to consume next message
- Success,
- // consume fail, suspends the current queue
- Suspend,
+ // consume success, application could continue to consume next message
+ Success,
+ // consume fail, suspends the current queue
+ Suspend,
};
#endif
diff --git a/src/main/cpp/include/OrderConsumer.h b/src/main/cpp/include/OrderConsumer.h
index cce53b6..a3018bf 100644
--- a/src/main/cpp/include/OrderConsumer.h
+++ b/src/main/cpp/include/OrderConsumer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ORDERCONSUMER_H__
#define __ORDERCONSUMER_H__
@@ -5,15 +22,18 @@
namespace ons {
-class ONSCLIENT_API OrderConsumer {
- public:
- OrderConsumer() {}
- virtual ~OrderConsumer() {}
+ class ONSCLIENT_API OrderConsumer {
+ public:
+ OrderConsumer() {}
+
+ virtual ~OrderConsumer() {}
+
+ virtual void start() = 0;
+
+ virtual void shutdown() = 0;
- virtual void start() = 0;
- virtual void shutdown() = 0;
- virtual void subscribe(const char* topic, const char* subExpression,
- MessageOrderListener* listener) = 0;
-};
+ virtual void subscribe(const char *topic, const char *subExpression,
+ MessageOrderListener *listener) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/OrderProducer.h b/src/main/cpp/include/OrderProducer.h
index 8924996..fe6c42d 100644
--- a/src/main/cpp/include/OrderProducer.h
+++ b/src/main/cpp/include/OrderProducer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ORDERLYPRODUCER_H__
#define __ORDERLYPRODUCER_H__
@@ -6,18 +23,20 @@
namespace ons {
-class ONSCLIENT_API OrderProducer {
- public:
- OrderProducer() {}
- virtual ~OrderProducer() {}
+ class ONSCLIENT_API OrderProducer {
+ public:
+ OrderProducer() {}
+
+ virtual ~OrderProducer() {}
+
+ // before send msg, start must be called to allocate resources.
+ virtual void start() = 0;
- // before send msg, start must be called to allocate resources.
- virtual void start() = 0;
- // before exit ons, shutdown must be called to release all resources allocated
- // by ons internally.
- virtual void shutdown() = 0;
+ // before exit ons, shutdown must be called to release all resources allocated
+ // by ons internally.
+ virtual void shutdown() = 0;
- virtual SendResultONS send(Message& msg, std::string shardingKey) = 0;
-};
+ virtual SendResultONS send(Message &msg, std::string shardingKey) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/Producer.h b/src/main/cpp/include/Producer.h
index 2daf759..f961c11 100644
--- a/src/main/cpp/include/Producer.h
+++ b/src/main/cpp/include/Producer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __PRODUCER_H__
#define __PRODUCER_H__
@@ -9,27 +26,31 @@
namespace ons {
-class ONSCLIENT_API Producer {
- public:
- Producer() {}
- virtual ~Producer() {}
-
- // before send msg, start must be called to allocate resources.
- virtual void start() = 0;
- // before exit ons, shutdown must be called to release all resources allocated
- // by ons internally.
- virtual void shutdown() = 0;
- // retry max 3 times if send failed. if no exception throwed, it sends
- // success;
- virtual ons::SendResultONS send(Message& msg) throw(ons::ONSClientException) = 0;
- virtual ons::SendResultONS send(Message& msg,
- const MessageQueueONS& mq) throw(ons::ONSClientException) = 0;
-
- // async send
- virtual void sendAsync(Message& msg, ons::SendCallbackONS* callback) throw(ons::ONSClientException) = 0;
-
- // oneway send
- virtual void sendOneway(Message& msg) throw(ons::ONSClientException) = 0;
-};
+ class ONSCLIENT_API Producer {
+ public:
+ Producer() {}
+
+ virtual ~Producer() {}
+
+ // before send msg, start must be called to allocate resources.
+ virtual void start() = 0;
+
+ // before exit ons, shutdown must be called to release all resources allocated
+ // by ons internally.
+ virtual void shutdown() = 0;
+
+ // retry max 3 times if send failed. if no exception throwed, it sends
+ // success;
+ virtual ons::SendResultONS send(Message &msg) throw(ons::ONSClientException) = 0;
+
+ virtual ons::SendResultONS send(Message &msg,
+ const MessageQueueONS &mq) throw(ons::ONSClientException) = 0;
+
+ // async send
+ virtual void sendAsync(Message &msg, ons::SendCallbackONS *callback) throw(ons::ONSClientException) = 0;
+
+ // oneway send
+ virtual void sendOneway(Message &msg) throw(ons::ONSClientException) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/PullConsumer.h b/src/main/cpp/include/PullConsumer.h
index 5f94e5a..29d4011 100755
--- a/src/main/cpp/include/PullConsumer.h
+++ b/src/main/cpp/include/PullConsumer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __PULLCONSUMER_H__
#define __PULLCONSUMER_H__
@@ -8,31 +25,42 @@
namespace ons {
-class ONSFactoryProperty;
-
-class ONSCLIENT_API PullConsumer {
- public:
- PullConsumer() {}
- virtual ~PullConsumer() {}
-
- virtual void start() = 0;
- virtual void shutdown() = 0;
- virtual void fetchSubscribeMessageQueues(
- const std::string& topic, std::vector<MessageQueueONS>& mqs) = 0;
- virtual PullResultONS pull(const MessageQueueONS& mq,
- const std::string& subExpression, long long offset,
- int maxNums) = 0;
- virtual long long searchOffset(const MessageQueueONS& mq, long long timestamp) = 0;
- virtual long long maxOffset(const MessageQueueONS& mq) = 0;
- virtual long long minOffset(const MessageQueueONS& mq) = 0;
- virtual void updateConsumeOffset(const MessageQueueONS& mq,
- long long offset) = 0;
- virtual void removeConsumeOffset(const MessageQueueONS& mq) = 0;
- virtual long long fetchConsumeOffset(const MessageQueueONS& mq,
- bool fromStore) = 0;
- virtual void persistConsumerOffset4PullConsumer(const MessageQueueONS& mq)
- throw(ons::ONSClientException) = 0;
-};
+ class ONSFactoryProperty;
+
+ class ONSCLIENT_API PullConsumer {
+ public:
+ PullConsumer() {}
+
+ virtual ~PullConsumer() {}
+
+ virtual void start() = 0;
+
+ virtual void shutdown() = 0;
+
+ virtual void fetchSubscribeMessageQueues(
+ const std::string &topic, std::vector<MessageQueueONS> &mqs) = 0;
+
+ virtual PullResultONS pull(const MessageQueueONS &mq,
+ const std::string &subExpression, long long offset,
+ int maxNums) = 0;
+
+ virtual long long searchOffset(const MessageQueueONS &mq, long long timestamp) = 0;
+
+ virtual long long maxOffset(const MessageQueueONS &mq) = 0;
+
+ virtual long long minOffset(const MessageQueueONS &mq) = 0;
+
+ virtual void updateConsumeOffset(const MessageQueueONS &mq,
+ long long offset) = 0;
+
+ virtual void removeConsumeOffset(const MessageQueueONS &mq) = 0;
+
+ virtual long long fetchConsumeOffset(const MessageQueueONS &mq,
+ bool fromStore) = 0;
+
+ virtual void persistConsumerOffset4PullConsumer(const MessageQueueONS &mq)
+ throw(ons::ONSClientException) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/PullResultONS.h b/src/main/cpp/include/PullResultONS.h
index 2d939ea..6f3987c 100644
--- a/src/main/cpp/include/PullResultONS.h
+++ b/src/main/cpp/include/PullResultONS.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __PULLRESULTONS_H__
#define __PULLRESULTONS_H__
@@ -7,34 +24,34 @@
namespace ons {
-enum ONSPullStatus {
- ONS_FOUND,
- ONS_NO_NEW_MSG,
- ONS_NO_MATCHED_MSG,
- ONS_OFFSET_ILLEGAL,
- ONS_BROKER_TIMEOUT // indicate pull request timeout or received NULL response
-};
-
-class ONSCLIENT_API PullResultONS {
- public:
- PullResultONS(ONSPullStatus status)
- : pullStatus(status), nextBeginOffset(0), minOffset(0), maxOffset(0) {}
-
- PullResultONS(ONSPullStatus pullStatus, long long nextBeginOffset,
- long long minOffset, long long maxOffset)
- : pullStatus(pullStatus),
- nextBeginOffset(nextBeginOffset),
- minOffset(minOffset),
- maxOffset(maxOffset) {}
-
- virtual ~PullResultONS() {}
-
- public:
- ONSPullStatus pullStatus;
- long long nextBeginOffset;
- long long minOffset;
- long long maxOffset;
- std::vector<Message> msgFoundList;
-};
+ enum ONSPullStatus {
+ ONS_FOUND,
+ ONS_NO_NEW_MSG,
+ ONS_NO_MATCHED_MSG,
+ ONS_OFFSET_ILLEGAL,
+ ONS_BROKER_TIMEOUT // indicate pull request timeout or received NULL response
+ };
+
+ class ONSCLIENT_API PullResultONS {
+ public:
+ PullResultONS(ONSPullStatus status)
+ : pullStatus(status), nextBeginOffset(0), minOffset(0), maxOffset(0) {}
+
+ PullResultONS(ONSPullStatus pullStatus, long long nextBeginOffset,
+ long long minOffset, long long maxOffset)
+ : pullStatus(pullStatus),
+ nextBeginOffset(nextBeginOffset),
+ minOffset(minOffset),
+ maxOffset(maxOffset) {}
+
+ virtual ~PullResultONS() {}
+
+ public:
+ ONSPullStatus pullStatus;
+ long long nextBeginOffset;
+ long long minOffset;
+ long long maxOffset;
+ std::vector<Message> msgFoundList;
+ };
}
#endif
diff --git a/src/main/cpp/include/PushConsumer.h b/src/main/cpp/include/PushConsumer.h
index 925858c..2356ec3 100644
--- a/src/main/cpp/include/PushConsumer.h
+++ b/src/main/cpp/include/PushConsumer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __PUSHCONSUMER_H__
#define __PUSHCONSUMER_H__
@@ -5,16 +22,19 @@
namespace ons {
-class ONSCLIENT_API PushConsumer {
- public:
- PushConsumer() {}
- virtual ~PushConsumer() {}
-
- virtual void start() = 0;
- virtual void shutdown() = 0;
- virtual void subscribe(const char* topic, const char* subExpression,
- MessageListener* listener) = 0;
- // virtual void setNamesrvAddr(const std::string& nameSrvAddr) = 0;
-};
+ class ONSCLIENT_API PushConsumer {
+ public:
+ PushConsumer() {}
+
+ virtual ~PushConsumer() {}
+
+ virtual void start() = 0;
+
+ virtual void shutdown() = 0;
+
+ virtual void subscribe(const char *topic, const char *subExpression,
+ MessageListener *listener) = 0;
+ // virtual void setNamesrvAddr(const std::string& nameSrvAddr) = 0;
+ };
}
#endif
diff --git a/src/main/cpp/include/SendResultONS.h b/src/main/cpp/include/SendResultONS.h
index d21ec12..24993ec 100644
--- a/src/main/cpp/include/SendResultONS.h
+++ b/src/main/cpp/include/SendResultONS.h
@@ -1,19 +1,40 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __SENDRESULTONS_H__
#define __SENDRESULTONS_H__
+
#include <string>
#include "ONSClient.h"
namespace ons {
-class ONSCLIENT_API SendResultONS {
- public:
- SendResultONS();
- virtual ~SendResultONS();
- void setMessageId(const std::string& msgId);
- const char* getMessageId() const;
+ class ONSCLIENT_API SendResultONS {
+ public:
+ SendResultONS();
+
+ virtual ~SendResultONS();
+
+ void setMessageId(const std::string &msgId);
+
+ const char *getMessageId() const;
- private:
- std::string messageId;
-};
+ private:
+ std::string messageId;
+ };
}
#endif
diff --git a/src/main/cpp/include/TransactionProducer.h b/src/main/cpp/include/TransactionProducer.h
index bceadb0..1fdb27b 100644
--- a/src/main/cpp/include/TransactionProducer.h
+++ b/src/main/cpp/include/TransactionProducer.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __TRANSACTIONPRODUCER_H__
#define __TRANSACTIONPRODUCER_H__
diff --git a/src/main/cpp/include/TransactionStatus.h b/src/main/cpp/include/TransactionStatus.h
index c47cd99..392178c 100644
--- a/src/main/cpp/include/TransactionStatus.h
+++ b/src/main/cpp/include/TransactionStatus.h
@@ -1,13 +1,30 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __TRANSACTIONSTATUS_H__
#define __TRANSACTIONSTATUS_H__
namespace ons {
-enum TransactionStatus {
- CommitTransaction = 0,
- RollbackTransaction = 1,
- Unknow = 2,
-};
+ enum TransactionStatus {
+ CommitTransaction = 0,
+ RollbackTransaction = 1,
+ Unknow = 2,
+ };
}
#endif
diff --git a/src/main/cpp/sdk/ClientBase.cpp b/src/main/cpp/sdk/ClientBase.cpp
index a99b9a2..180e2bf 100644
--- a/src/main/cpp/sdk/ClientBase.cpp
+++ b/src/main/cpp/sdk/ClientBase.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ClientBase.h"
#include "UtilAll.h"
diff --git a/src/main/cpp/sdk/ClientBase.h b/src/main/cpp/sdk/ClientBase.h
index 3dfd83b..5e0de04 100644
--- a/src/main/cpp/sdk/ClientBase.h
+++ b/src/main/cpp/sdk/ClientBase.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_CLIENT_BASE_H
#define MQ_CLIENT_BASE_H
diff --git a/src/main/cpp/sdk/ConsumerImpl.cpp b/src/main/cpp/sdk/ConsumerImpl.cpp
index 1bf9459..286e96d 100644
--- a/src/main/cpp/sdk/ConsumerImpl.cpp
+++ b/src/main/cpp/sdk/ConsumerImpl.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ConsumerImpl.h"
#include "common/Logger.h"
#include "common/UtilAll.h"
diff --git a/src/main/cpp/sdk/ConsumerImpl.h b/src/main/cpp/sdk/ConsumerImpl.h
index 550adbc..3648946 100644
--- a/src/main/cpp/sdk/ConsumerImpl.h
+++ b/src/main/cpp/sdk/ConsumerImpl.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_CONSUMER_IMPL_H
#define MQ_CONSUMER_IMPL_H
@@ -8,15 +25,20 @@
namespace ons {
-class ConsumerImpl : public PushConsumer, public ClientBase {
- public:
- ConsumerImpl();
- ConsumerImpl(const ons::ONSFactoryProperty &factoryProperty) throw(ons::ONSClientException);
- virtual ~ConsumerImpl();
- void start();
- void shutdown();
- void subscribe(const char* topic, const char* subExpression, ons::MessageListener* listener);
-};
+ class ConsumerImpl : public PushConsumer, public ClientBase {
+ public:
+ ConsumerImpl();
+
+ ConsumerImpl(const ons::ONSFactoryProperty &factoryProperty) throw(ons::ONSClientException);
+
+ virtual ~ConsumerImpl();
+
+ void start();
+
+ void shutdown();
+
+ void subscribe(const char *topic, const char *subExpression, ons::MessageListener *listener);
+ };
} // namespace ons
diff --git a/src/main/cpp/sdk/Message.cpp b/src/main/cpp/sdk/Message.cpp
index 84bff8c..167282f 100644
--- a/src/main/cpp/sdk/Message.cpp
+++ b/src/main/cpp/sdk/Message.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "Message.h"
#include "ONSClientException.h"
#include "common/UtilAll.h"
diff --git a/src/main/cpp/sdk/MessageQueueONS.cpp b/src/main/cpp/sdk/MessageQueueONS.cpp
index 76c6147..2d9a108 100644
--- a/src/main/cpp/sdk/MessageQueueONS.cpp
+++ b/src/main/cpp/sdk/MessageQueueONS.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "MessageQueueONS.h"
#include "ONSClientException.h"
#include "UtilAll.h"
diff --git a/src/main/cpp/sdk/ONSClientException.cpp b/src/main/cpp/sdk/ONSClientException.cpp
index af2d32d..b5f8cd5 100644
--- a/src/main/cpp/sdk/ONSClientException.cpp
+++ b/src/main/cpp/sdk/ONSClientException.cpp
@@ -1,14 +1,35 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ONSClientException.h"
#include <string>
namespace ons {
ONSClientException::ONSClientException() throw() {}
+
ONSClientException::~ONSClientException() throw() {}
+
ONSClientException::ONSClientException(std::string msg, int error) throw()
: m_msg(msg), m_error(error) {}
- const char* ONSClientException::what() const throw() { return m_msg.c_str(); }
- const char* ONSClientException::GetMsg() const throw() { return m_msg.c_str(); }
+ const char *ONSClientException::what() const throw() { return m_msg.c_str(); }
+
+ const char *ONSClientException::GetMsg() const throw() { return m_msg.c_str(); }
+
int ONSClientException::GetError() const throw() { return m_error; }
}
diff --git a/src/main/cpp/sdk/ONSFactory.cpp b/src/main/cpp/sdk/ONSFactory.cpp
index d8af628..662df85 100644
--- a/src/main/cpp/sdk/ONSFactory.cpp
+++ b/src/main/cpp/sdk/ONSFactory.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "rocketmq.h"
#include "ONSFactory.h"
#include "ProducerImpl.h"
@@ -171,6 +188,7 @@ namespace ons {
m_onsFactoryProperties.find(ConsumerId);
return (it == m_onsFactoryProperties.end()) ? NULL_STRING : (*it).second.c_str();
}
+
const char *ONSFactoryProperty::getGroupId() const {
map<string, string>::const_iterator it =
m_onsFactoryProperties.find(GroupId);
@@ -291,13 +309,13 @@ namespace ons {
m_onsFactoryProperties.find(ConsumerInstanceName);
return (it == m_onsFactoryProperties.end()) ? NULL_STRING : (*it).second.c_str();
}
+
const char *ONSFactoryProperty::getInstanceId() const {
map<string, string>::const_iterator it =
m_onsFactoryProperties.find(InstanceId);
return (it == m_onsFactoryProperties.end()) ? NULL_STRING : (*it).second.c_str();
}
-
class ONSFactoryInstance : public ONSFactoryAPI {
public:
@@ -341,13 +359,13 @@ namespace ons {
using namespace ons;
int validateProperty(ONSFactoryProperty factoryProperty) throw(ons::ONSClientException) {
- if (NULL_STRING == factoryProperty.getAccessKey()){
+ if (NULL_STRING == factoryProperty.getAccessKey()) {
throw ONSClientException(
FAQ::errorMessage("AccessKey must be set, please set it.",
FAQ::CLIENT_CHECK_MSG_EXCEPTION),
-1);
}
- if (NULL_STRING == factoryProperty.getSecretKey()){
+ if (NULL_STRING == factoryProperty.getSecretKey()) {
throw ONSClientException(
FAQ::errorMessage("SecretKey must be set, please set it.",
FAQ::CLIENT_CHECK_MSG_EXCEPTION),
@@ -384,11 +402,11 @@ ONSFactoryInstance::~ONSFactoryInstance() {
}
Producer *ONSFactoryInstance::createProducer(ons::ONSFactoryProperty factoryProperty) throw(ONSClientException) {
- if (INNER == factoryProperty.getOnsChannel()){
+ if (INNER == factoryProperty.getOnsChannel()) {
factoryProperty.setOnsTraceSwitch(false);
- factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR,"LocalDefault");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR, "LocalDefault");
}
validateProperty(factoryProperty);
ProducerImpl *producerImpl = new ProducerImpl(factoryProperty);
@@ -398,11 +416,11 @@ Producer *ONSFactoryInstance::createProducer(ons::ONSFactoryProperty factoryProp
OrderProducer *ONSFactoryInstance::createOrderProducer(ons::ONSFactoryProperty factoryProperty) throw(
ONSClientException) {
- if (INNER == factoryProperty.getOnsChannel()){
+ if (INNER == factoryProperty.getOnsChannel()) {
factoryProperty.setOnsTraceSwitch(false);
- factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR,"LocalDefault");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR, "LocalDefault");
}
validateProperty(factoryProperty);
OrderProducerImpl *orderProducerImpl = new OrderProducerImpl(factoryProperty);
@@ -413,11 +431,11 @@ ONSClientException) {
OrderConsumer *ONSFactoryInstance::createOrderConsumer(ons::ONSFactoryProperty factoryProperty) throw(
ONSClientException) {
- if (INNER == factoryProperty.getOnsChannel()){
+ if (INNER == factoryProperty.getOnsChannel()) {
factoryProperty.setOnsTraceSwitch(false);
- factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR,"LocalDefault");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR, "LocalDefault");
}
validateProperty(factoryProperty);
OrderConsumerImpl *consumer = new OrderConsumerImpl(factoryProperty);
@@ -428,11 +446,11 @@ ONSClientException) {
TransactionProducer *ONSFactoryInstance::createTransactionProducer(
ons::ONSFactoryProperty factoryProperty,
ons::LocalTransactionChecker *checker) throw(ons::ONSClientException) {
- if (INNER == factoryProperty.getOnsChannel()){
+ if (INNER == factoryProperty.getOnsChannel()) {
factoryProperty.setOnsTraceSwitch(false);
- factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR,"LocalDefault");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR, "LocalDefault");
}
validateProperty(factoryProperty);
if (checker == NULL) {
@@ -452,11 +470,11 @@ ONSFactoryInstance::createPullConsumer(ons::ONSFactoryProperty factoryProperty)
PushConsumer *
ONSFactoryInstance::createPushConsumer(ons::ONSFactoryProperty factoryProperty) throw(ons::ONSClientException) {
- if (INNER == factoryProperty.getOnsChannel()){
+ if (INNER == factoryProperty.getOnsChannel()) {
factoryProperty.setOnsTraceSwitch(false);
- factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey,"DefaultKey");
- factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR,"LocalDefault");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::AccessKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::SecretKey, "DefaultKey");
+ factoryProperty.setFactoryProperty(ONSFactoryProperty::NAMESRV_ADDR, "LocalDefault");
}
validateProperty(factoryProperty);
ConsumerImpl *consumer = new ConsumerImpl(factoryProperty);
diff --git a/src/main/cpp/sdk/OrderConsumerImpl.cpp b/src/main/cpp/sdk/OrderConsumerImpl.cpp
index 8472895..496f263 100644
--- a/src/main/cpp/sdk/OrderConsumerImpl.cpp
+++ b/src/main/cpp/sdk/OrderConsumerImpl.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "OrderConsumerImpl.h"
#include "rocketmq.h"
#include "rocketmq-ons-cpp-full.h"
@@ -39,14 +56,14 @@ void OrderConsumerImpl::shutdown() {
#ifdef __cplusplus
extern "C" {
#endif
-int order_consumer_on_message(void *thread, void *opaque, char *topic, char *user_props, char *sys_props, char* body,
+int order_consumer_on_message(void *thread, void *opaque, char *topic, char *user_props, char *sys_props, char *body,
int body_len) {
ons::MessageOrderListener *listener = reinterpret_cast<ons::MessageOrderListener *>(opaque);
ons::Message message_;
message_.setTopic(topic);
ons::UtilAll::fill_message_props(message_, std::string(user_props), false);
ons::UtilAll::fill_message_props(message_, std::string(sys_props), true);
- message_.setBody(reinterpret_cast<unsigned char*>(body), body_len);
+ message_.setBody(reinterpret_cast<unsigned char *>(body), body_len);
ons::ConsumeOrderContext ctx_;
OrderAction action = listener->consume(message_, ctx_);
switch (action) {
@@ -54,7 +71,7 @@ int order_consumer_on_message(void *thread, void *opaque, char *topic, char *use
return 0;
case Suspend:
spdlog::info("Consume Order Message failed, Topic:{}, MessageId:{}, RecosumeTimes:{}",
- message_.getTopic(),message_.getMsgID(),message_.getReconsumeTimes());
+ message_.getTopic(), message_.getMsgID(), message_.getReconsumeTimes());
return 1;
default:
return 1;
diff --git a/src/main/cpp/sdk/OrderConsumerImpl.h b/src/main/cpp/sdk/OrderConsumerImpl.h
index 32aa0bc..e6169bf 100644
--- a/src/main/cpp/sdk/OrderConsumerImpl.h
+++ b/src/main/cpp/sdk/OrderConsumerImpl.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_ORDER_CONSUMER_IMPL_H
#define MQ_ORDER_CONSUMER_IMPL_H
@@ -9,15 +26,18 @@
#include "ClientBase.h"
namespace ons {
-class OrderConsumerImpl : public ons::OrderConsumer, ClientBase {
+ class OrderConsumerImpl : public ons::OrderConsumer, ClientBase {
public:
- OrderConsumerImpl(const ons::ONSFactoryProperty &property) throw (ons::ONSClientException);
- virtual ~OrderConsumerImpl();
+ OrderConsumerImpl(const ons::ONSFactoryProperty &property) throw(ons::ONSClientException);
+
+ virtual ~OrderConsumerImpl();
+
+ void start();
+
+ void shutdown();
- void start();
- void shutdown();
- void subscribe(const char* topic, const char* subExpression,
- ons::MessageOrderListener* listener);
+ void subscribe(const char *topic, const char *subExpression,
+ ons::MessageOrderListener *listener);
};
}
diff --git a/src/main/cpp/sdk/OrderProducerImpl.cpp b/src/main/cpp/sdk/OrderProducerImpl.cpp
index 4cb5ff5..2e78f6f 100644
--- a/src/main/cpp/sdk/OrderProducerImpl.cpp
+++ b/src/main/cpp/sdk/OrderProducerImpl.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "OrderProducerImpl.h"
#include "rocketmq.h"
#include "rocketmq-ons-cpp-full.h"
@@ -42,7 +59,7 @@ SendResultONS OrderProducerImpl::send(Message &msg, std::string shardingKey) thr
SendResultWrapper wrapper(sendResult);
graal_isolatethread_t *thread_;
ThreadAttachment attachment(&thread_);
- send_order_message(thread_, instanceIndex_, &m, &sendResult,(char*)shardingKey.c_str());
+ send_order_message(thread_, instanceIndex_, &m, &sendResult, (char *) shardingKey.c_str());
if (sendResult.error_no) {
ONSClientException clientException(std::string(sendResult.error_msg), sendResult.error_no);
throw clientException;
diff --git a/src/main/cpp/sdk/OrderProducerImpl.h b/src/main/cpp/sdk/OrderProducerImpl.h
index 31acbcb..f930696 100644
--- a/src/main/cpp/sdk/OrderProducerImpl.h
+++ b/src/main/cpp/sdk/OrderProducerImpl.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_ORDERPRODUCERIMPL_H
#define MQ_ORDERPRODUCERIMPL_H
@@ -18,7 +35,7 @@ namespace ons {
void shutdown();
- SendResultONS send(Message &msg,std::string ShardingKey) throw(ons::ONSClientException);
+ SendResultONS send(Message &msg, std::string ShardingKey) throw(ons::ONSClientException);
};
} // namespace ons
diff --git a/src/main/cpp/sdk/ProducerImpl.cpp b/src/main/cpp/sdk/ProducerImpl.cpp
index 1ce810a..cd4085a 100644
--- a/src/main/cpp/sdk/ProducerImpl.cpp
+++ b/src/main/cpp/sdk/ProducerImpl.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "ProducerImpl.h"
#include "rocketmq.h"
#include "rocketmq-ons-cpp-full.h"
diff --git a/src/main/cpp/sdk/ProducerImpl.h b/src/main/cpp/sdk/ProducerImpl.h
index 0fa66a5..6fd1295 100644
--- a/src/main/cpp/sdk/ProducerImpl.h
+++ b/src/main/cpp/sdk/ProducerImpl.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_PRODUCER_IMPL_H
#define MQ_PRODUCER_IMPL_H
diff --git a/src/main/cpp/sdk/RocketMQClient.h b/src/main/cpp/sdk/RocketMQClient.h
index 8032b71..93df96e 100644
--- a/src/main/cpp/sdk/RocketMQClient.h
+++ b/src/main/cpp/sdk/RocketMQClient.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __ROCKETMQCLIENT_H__
#define __ROCKETMQCLIENT_H__
diff --git a/src/main/cpp/sdk/SendResultONS.cpp b/src/main/cpp/sdk/SendResultONS.cpp
index 51824ff..6f5b940 100644
--- a/src/main/cpp/sdk/SendResultONS.cpp
+++ b/src/main/cpp/sdk/SendResultONS.cpp
@@ -1,3 +1,19 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "SendResultONS.h"
#include <string>
diff --git a/src/main/cpp/sdk/TransactionProducerImpl.cpp b/src/main/cpp/sdk/TransactionProducerImpl.cpp
index 6f1051d..31f8db8 100644
--- a/src/main/cpp/sdk/TransactionProducerImpl.cpp
+++ b/src/main/cpp/sdk/TransactionProducerImpl.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "TransactionProducerImpl.h"
#include "rocketmq-ons-cpp-full.h"
#include "Logger.h"
diff --git a/src/main/cpp/sdk/TransactionProducerImpl.h b/src/main/cpp/sdk/TransactionProducerImpl.h
index 221fa42..39bd529 100644
--- a/src/main/cpp/sdk/TransactionProducerImpl.h
+++ b/src/main/cpp/sdk/TransactionProducerImpl.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __TRANSACTIONPRODUCERIMPL_H__
#define __TRANSACTIONPRODUCERIMPL_H__
diff --git a/src/main/cpp/sdk/common/Common.h b/src/main/cpp/sdk/common/Common.h
index a813785..278b2e8 100644
--- a/src/main/cpp/sdk/common/Common.h
+++ b/src/main/cpp/sdk/common/Common.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef __SDK_COMMON_H
#define __SDK_COMMON_H
diff --git a/src/main/cpp/sdk/common/Logger.cpp b/src/main/cpp/sdk/common/Logger.cpp
index 2f5e939..0df9643 100644
--- a/src/main/cpp/sdk/common/Logger.cpp
+++ b/src/main/cpp/sdk/common/Logger.cpp
@@ -1,5 +1,21 @@
-#include"Logger.h"
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include"Logger.h"
#include <sys/stat.h>
namespace rocketmq {
diff --git a/src/main/cpp/sdk/common/Logger.h b/src/main/cpp/sdk/common/Logger.h
index d4fbf0d..2d90237 100644
--- a/src/main/cpp/sdk/common/Logger.h
+++ b/src/main/cpp/sdk/common/Logger.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_LOGGER_H
#define MQ_LOGGER_H
diff --git a/src/main/cpp/sdk/common/ONSClientAbstract.cpp b/src/main/cpp/sdk/common/ONSClientAbstract.cpp
index 852050a..548757c 100644
--- a/src/main/cpp/sdk/common/ONSClientAbstract.cpp
+++ b/src/main/cpp/sdk/common/ONSClientAbstract.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include"ONSClientAbstract.h"
#include<string>
diff --git a/src/main/cpp/sdk/common/ONSClientAbstract.h b/src/main/cpp/sdk/common/ONSClientAbstract.h
index 10e5e3c..50a1161 100644
--- a/src/main/cpp/sdk/common/ONSClientAbstract.h
+++ b/src/main/cpp/sdk/common/ONSClientAbstract.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_ONSCLIENTABSTRACT_H
#define MQ_ONSCLIENTABSTRACT_H
diff --git a/src/main/cpp/sdk/common/UtilAll.cpp b/src/main/cpp/sdk/common/UtilAll.cpp
index 54d41c9..e6e9639 100644
--- a/src/main/cpp/sdk/common/UtilAll.cpp
+++ b/src/main/cpp/sdk/common/UtilAll.cpp
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "UtilAll.h"
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
diff --git a/src/main/cpp/sdk/common/UtilAll.h b/src/main/cpp/sdk/common/UtilAll.h
index ce16a79..45baebe 100644
--- a/src/main/cpp/sdk/common/UtilAll.h
+++ b/src/main/cpp/sdk/common/UtilAll.h
@@ -1,3 +1,20 @@
+/*
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef MQ_UTILALL_H
#define MQ_UTILALL_H
@@ -39,8 +56,8 @@ namespace ons {
static std::string to_string(const std::map<std::string, std::string> &prop);
- static graal_isolate_t* get_isolate() {
- static graal_isolate_t* singleton = nullptr;
+ static graal_isolate_t *get_isolate() {
+ static graal_isolate_t *singleton = nullptr;
if (nullptr == singleton) {
if (graal_create_isolate(nullptr, &singleton, nullptr)) {
spdlog::error("Failed to create graal isolate");
@@ -103,7 +120,6 @@ namespace ons {
}
};
-
class MessageConverter {
public:
MessageConverter(message &m, const Message &msg) : m_(m), msg_(msg) {
@@ -138,7 +154,7 @@ namespace ons {
class ThreadAttachment {
public:
- ThreadAttachment(graal_isolatethread_t **thread) throw (ons::ONSClientException) {
+ ThreadAttachment(graal_isolatethread_t **thread) throw(ons::ONSClientException) {
std::stringstream ss;
ss << std::this_thread::get_id();
@@ -182,7 +198,7 @@ namespace ons {
class SendResultWrapper {
public:
- SendResultWrapper(send_result &sr) : sr_(sr){
+ SendResultWrapper(send_result &sr) : sr_(sr) {
UtilAll::init_send_result(sr);
sr_ = sr;
}