Merge pull request #423 from xujianhai666/feat-stopall
[ISSUE #379] Restful add eliminate, stopAll interface.
diff --git a/rocketmq-client-dotnet/RocketMQ.Driver.sln b/rocketmq-client-dotnet/RocketMQ.Driver.sln
deleted file mode 100644
index b71431b..0000000
--- a/rocketmq-client-dotnet/RocketMQ.Driver.sln
+++ /dev/null
@@ -1,73 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.28606.126
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{47A2C6B5-474B-47CC-9CD4-D87167F0A87A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{923B715B-61C7-4EA4-B5D7-C7AF9206FFC0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{FDA44515-D5FD-4EA0-81E5-FCA8C67C6ECD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RocketMQ.Driver", "src\RocketMQ.Driver\RocketMQ.Driver.csproj", "{F768721E-933F-42F1-AC75-D7E94F9E555F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RocketMQ.Driver.Test", "test\RocketMQ.Driver.Test\RocketMQ.Driver.Test.csproj", "{72E0272F-59CC-454A-AC58-85FDBBFA9177}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProducerSample", "example\ProducerSample\ProducerSample.csproj", "{E20A0F21-72C9-41C2-9BA3-C39D522E88FD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PushConsumerSample", "example\PushConsumerSample\PushConsumerSample.csproj", "{61313119-1931-41E2-8363-89EAA9CE3BB4}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Debug|x64.ActiveCfg = Debug|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Debug|x64.Build.0 = Debug|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Release|Any CPU.Build.0 = Release|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Release|x64.ActiveCfg = Release|Any CPU
- {F768721E-933F-42F1-AC75-D7E94F9E555F}.Release|x64.Build.0 = Release|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Debug|x64.ActiveCfg = Debug|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Debug|x64.Build.0 = Debug|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Release|Any CPU.Build.0 = Release|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Release|x64.ActiveCfg = Release|Any CPU
- {72E0272F-59CC-454A-AC58-85FDBBFA9177}.Release|x64.Build.0 = Release|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Debug|x64.ActiveCfg = Debug|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Debug|x64.Build.0 = Debug|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Release|Any CPU.Build.0 = Release|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Release|x64.ActiveCfg = Release|Any CPU
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD}.Release|x64.Build.0 = Release|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Debug|x64.ActiveCfg = Debug|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Debug|x64.Build.0 = Debug|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Release|Any CPU.Build.0 = Release|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Release|x64.ActiveCfg = Release|Any CPU
- {61313119-1931-41E2-8363-89EAA9CE3BB4}.Release|x64.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {F768721E-933F-42F1-AC75-D7E94F9E555F} = {47A2C6B5-474B-47CC-9CD4-D87167F0A87A}
- {72E0272F-59CC-454A-AC58-85FDBBFA9177} = {923B715B-61C7-4EA4-B5D7-C7AF9206FFC0}
- {E20A0F21-72C9-41C2-9BA3-C39D522E88FD} = {FDA44515-D5FD-4EA0-81E5-FCA8C67C6ECD}
- {61313119-1931-41E2-8363-89EAA9CE3BB4} = {FDA44515-D5FD-4EA0-81E5-FCA8C67C6ECD}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {C23149E9-957F-4E68-A5C2-4426D539FEF8}
- EndGlobalSection
-EndGlobal
diff --git a/rocketmq-client-dotnet/example/ProducerSample/ProducerSample.csproj b/rocketmq-client-dotnet/example/ProducerSample/ProducerSample.csproj
deleted file mode 100644
index 91a7f46..0000000
--- a/rocketmq-client-dotnet/example/ProducerSample/ProducerSample.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.1</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\..\src\RocketMQ.Driver\RocketMQ.Driver.csproj" />
- </ItemGroup>
-
-</Project>
diff --git a/rocketmq-client-dotnet/example/ProducerSample/Program.cs b/rocketmq-client-dotnet/example/ProducerSample/Program.cs
deleted file mode 100644
index 7cdeee3..0000000
--- a/rocketmq-client-dotnet/example/ProducerSample/Program.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-using RocketMQ.Driver.Interop;
-
-namespace rocketmq_producer_test
-{
- class MainClass
- {
- private static ProducerWrap.QueueSelectorCallback _queueSelectorCallback = new ProducerWrap.QueueSelectorCallback(
- (size, message, args) =>
- {
- Console.WriteLine($"size: {size}, message: {message}, ptr: {args}");
-
- return 0;
- });
-
- public static void Main(string[] args)
- {
- Console.Title = "Producer";
-
- Console.WriteLine("Start create producer.");
- var producerPtr = ProducerWrap.CreateProducer("xxx");
- if (producerPtr == IntPtr.Zero)
- {
- Console.WriteLine("zero. Oops.");
- }
-
- Console.WriteLine(producerPtr.ToString());
- Console.WriteLine("end create producer.");
-
- var p = new MainClass();
- var producer = new HandleRef(p, producerPtr);
- try
- {
- var setNameServerAddressResult = ProducerWrap.SetProducerNameServerAddress(producer, "47.101.55.250:9876");
- Console.WriteLine("set name server address result:" + setNameServerAddressResult);
-
- var setProducerLogPathResult = ProducerWrap.SetProducerLogPath(producer, "C:/rocketmq_log.txt");
- Console.WriteLine("set producer log path result:" + setProducerLogPathResult);
-
- var setLogLevelResult = ProducerWrap.SetProducerLogLevel(producer, CLogLevel.E_LOG_LEVEL_TRACE);
- Console.WriteLine("set producer log level result:" + setLogLevelResult);
-
- var startResult = ProducerWrap.StartProducer(producer);
- Console.WriteLine("start result:" + startResult);
-
- while (true)
- {
- // message
- var message = MessageWrap.CreateMessage("test");
- Console.WriteLine("message intPtr:" + message);
-
- var p1 = new MainClass();
- var messageIntPtr = new HandleRef(p1, message);
-
- var setMessageBodyResult = MessageWrap.SetMessageBody(messageIntPtr, "hello" + Guid.NewGuid());
- Console.WriteLine("set message body result:" + setMessageBodyResult);
-
- var setTagResult = MessageWrap.SetMessageTags(messageIntPtr, "tag_test");
- Console.WriteLine("set message tag result:" + setTagResult);
-
- var setPropertyResult = MessageWrap.SetMessageProperty(messageIntPtr, "key1", "value1");
- Console.WriteLine("set message property result:" + setPropertyResult);
-
- // var setByteMessageBodyResult = MessageWrap.SetByteMessageBody(messageIntPtr, "byte_body", 9);
- // Console.WriteLine("set byte message body result:" + setByteMessageBodyResult);
-
-
- // SendMessageSync
- var sendResult = ProducerWrap.SendMessageSync(producer, messageIntPtr, out CSendResult sendResultStruct);
- Console.WriteLine("send result:" + sendResult + ", msgId: " + sendResultStruct.msgId.ToString());
-
- // SendMessageOneway
- // var sendResult = ProducerWrap.SendMessageOneway(producer, messageIntPtr);
- // Console.WriteLine("send result:" + sendResult);
-
- // SendMessageAsync
- // var sendResult = ProducerWrap.SendMessageAsync(
- // producer,
- // messageIntPtr,
- // result =>
- // {
- // Console.WriteLine($"success_callback_msgId: {result.msgId}");
- // },
- // ex =>
- // {
- // Console.WriteLine($"error_callback_msgId: {ex.msg}");
- // }
- // );
- // Console.WriteLine("send result:" + sendResult);
-
- // var pArgs = "args_parameters";
- // var ptrArgs = Marshal.StringToBSTR(pArgs);
- // var sendResult = ProducerWrap.SendMessageOrderly(producer, messageIntPtr, _queueSelectorCallback,
- // ptrArgs, 1, out var sendResultStruct);
- // Console.WriteLine($"send result:{sendResult}, sendResultStruct -> msgId: {sendResultStruct.msgId}, status: {sendResultStruct.sendStatus}, offset: {sendResultStruct.offset}");
-
- Thread.Sleep(500);
- }
-
- var shutdownResult = ProducerWrap.ShutdownProducer(producer);
- Console.WriteLine("shutdown result:" + shutdownResult);
-
- var destoryResult = ProducerWrap.DestroyProducer(producer);
- Console.WriteLine("destory result:" + destoryResult);
- }
- catch (Exception e)
- {
- Console.WriteLine(e.ToString());
- }
- Console.ReadKey(true);
- }
- }
-}
diff --git a/rocketmq-client-dotnet/example/PushConsumerSample/Program.cs b/rocketmq-client-dotnet/example/PushConsumerSample/Program.cs
deleted file mode 100644
index 41acb3e..0000000
--- a/rocketmq-client-dotnet/example/PushConsumerSample/Program.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-using RocketMQ.Driver.Interop;
-
-namespace rocketmq_push_consumer_test
-{
- class Program
- {
- private static readonly PushConsumerWrap.MessageCallBack _callback = new PushConsumerWrap.MessageCallBack(HandleMessageCallBack);
-
- static void Main(string[] args)
- {
- Console.Title = "PushConsumer";
-
- Task.Run(() => {
- Console.WriteLine("start push consumer...");
-
- var consumerPtr = PushConsumerWrap.CreatePushConsumer("xxx");
- var p = new Program();
- var consumer = new HandleRef(p, consumerPtr);
- Console.WriteLine($"consumer: {consumer}");
- var r0 = PushConsumerWrap.SetPushConsumerLogLevel(consumer, CLogLevel.E_LOG_LEVEL_TRACE);
-
- var groupId = PushConsumerWrap.GetPushConsumerGroupID(consumer.Handle);
- Console.WriteLine($"groupId: {groupId}");
-
- var r1 = PushConsumerWrap.SetPushConsumerNameServerAddress(consumer, "47.101.55.250:9876");
- var r2 = PushConsumerWrap.Subscribe(consumer, "test", "*");
- var r3 = PushConsumerWrap.RegisterMessageCallback(consumer, _callback);
- var r10 = PushConsumerWrap.StartPushConsumer(consumer);
- Console.WriteLine($"start push consumer ptr: {r10}");
-
- while (true)
- {
- Thread.Sleep(500);
- }
- });
- Console.ReadKey(true);
-
- //PushConsumerBinder.DestroyPushConsumer(consumer);
- }
-
- public static int HandleMessageCallBack(IntPtr consumer, IntPtr message)
- {
- Console.WriteLine($"consumer: {consumer}; messagePtr: {message}");
-
- var body = MessageWrap.GetMessageBody(message);
- Console.WriteLine($"body: {body}");
-
- var messageId = MessageWrap.GetMessageId(message);
- Console.WriteLine($"message_id: {messageId}");
-
- return 0;
- }
- }
-}
diff --git a/rocketmq-client-dotnet/example/PushConsumerSample/PushConsumerSample.csproj b/rocketmq-client-dotnet/example/PushConsumerSample/PushConsumerSample.csproj
deleted file mode 100644
index 91a7f46..0000000
--- a/rocketmq-client-dotnet/example/PushConsumerSample/PushConsumerSample.csproj
+++ /dev/null
@@ -1,12 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.1</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\..\src\RocketMQ.Driver\RocketMQ.Driver.csproj" />
- </ItemGroup>
-
-</Project>
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/DefaultConsumerBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/DefaultConsumerBuilder.cs
deleted file mode 100644
index eded210..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/DefaultConsumerBuilder.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using RocketMQ.Driver.Consumer.Internal;
-using RocketMQ.Driver.Interop;
-
-namespace RocketMQ.Driver.Consumer
-{
- public class DefaultPushConsumerBuilder : IPushConsumerBuilder
- {
- private HandleRef _handleRef;
-
- public DefaultPushConsumerBuilder(string groupId)
- {
- if (string.IsNullOrWhiteSpace(groupId))
- {
- throw new ArgumentNullException(nameof(groupId));
- }
-
- var handle = PushConsumerWrap.CreatePushConsumer(groupId);
-
- if (handle == IntPtr.Zero)
- {
- throw new RocketMQConsumerException($"create consumer error, ptr is {handle}");
- }
-
- this._handleRef = new HandleRef(this, handle);
- }
-
- public IPushConsumerBuilder SetPushConsumerGroupId(string groupId)
- {
- if (string.IsNullOrWhiteSpace(groupId))
- {
- throw new ArgumentNullException(nameof(groupId));
- }
-
- var result = PushConsumerWrap.SetPushConsumerGroupID(this._handleRef, groupId);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer groupId error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerNameServerAddress(string nameServerAddress)
- {
- if (string.IsNullOrWhiteSpace(nameServerAddress))
- {
- throw new ArgumentNullException(nameof(nameServerAddress));
- }
-
- var result = PushConsumerWrap.SetPushConsumerNameServerAddress(this._handleRef, nameServerAddress);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer nameServerAddress error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerNameServerDomain(string domain)
- {
- if (string.IsNullOrWhiteSpace(domain))
- {
- throw new ArgumentNullException(nameof(domain));
- }
-
- var result = PushConsumerWrap.SetPushConsumerNameServerDomain(this._handleRef, domain);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer domain error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerThreadCount(int threadCount)
- {
- if (threadCount <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(threadCount));
- }
-
- var result = PushConsumerWrap.SetPushConsumerThreadCount(this._handleRef, threadCount);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer threadCount error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerMessageBatchMaxSize(int batchSize)
- {
- if (batchSize <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(batchSize));
- }
-
- var result = PushConsumerWrap.SetPushConsumerMessageBatchMaxSize(this._handleRef, batchSize);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer batchSize error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerInstanceName(string instanceName)
- {
- if (string.IsNullOrWhiteSpace(instanceName))
- {
- throw new ArgumentNullException(nameof(instanceName));
- }
-
- var result = PushConsumerWrap.SetPushConsumerInstanceName(this._handleRef, instanceName);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer instanceName error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerSessionCredentials(string accessKey, string secretKey, string channel)
- {
- if (string.IsNullOrWhiteSpace(accessKey))
- {
- throw new ArgumentNullException(nameof(accessKey));
- }
- if (string.IsNullOrWhiteSpace(secretKey))
- {
- throw new ArgumentNullException(nameof(secretKey));
- }
- if (string.IsNullOrWhiteSpace(channel))
- {
- throw new ArgumentNullException(nameof(channel));
- }
-
- var result = PushConsumerWrap.SetPushConsumerSessionCredentials(this._handleRef, accessKey, secretKey, channel);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer sessionCredentials error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerLogPath(string logPath)
- {
- if (string.IsNullOrWhiteSpace(logPath))
- {
- throw new ArgumentNullException(nameof(logPath));
- }
-
- var result = PushConsumerWrap.SetPushConsumerLogPath(this._handleRef, logPath);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer logPath error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerLogLevel(LogLevel logLevel)
- {
- if (logLevel == LogLevel.None)
- {
- throw new ArgumentException(nameof(logLevel));
- }
-
- var result = PushConsumerWrap.SetPushConsumerLogLevel(this._handleRef, (CLogLevel)logLevel);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer logLevel error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerLogFileNumAndSize(int fileNum, long fileSize)
- {
- if (fileNum <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(fileNum));
- }
- if (fileSize <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(fileSize));
- }
-
- var result = PushConsumerWrap.SetPushConsumerLogFileNumAndSize(this._handleRef, fileNum, fileSize);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer logFileNumAndSize error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumerBuilder SetPushConsumerMessageModel(MessageModel messageModel)
- {
- var result = PushConsumerWrap.SetPushConsumerMessageModel(this._handleRef, (CMessageModel)messageModel);
- if (result != 0)
- {
- throw new RocketMQConsumerException($"set consumer logFileNumAndSize error. cpp sdk return code {result}");
- }
-
- return this;
- }
-
- public IPushConsumer Build()
- {
- if (this._handleRef.Handle == IntPtr.Zero)
- {
- throw new RocketMQConsumerException("consumer ptr is zero.");
- }
-
- return new DefaultPushConsumer(this._handleRef.Handle);
- }
-
- public void Dispose()
- {
- if (this._handleRef.Handle != IntPtr.Zero)
- {
- this._handleRef = new HandleRef(null, IntPtr.Zero);
- GC.SuppressFinalize(this);
- }
- }
-
- ~DefaultPushConsumerBuilder()
- {
- this.Dispose();
- }
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumer.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumer.cs
deleted file mode 100644
index 7bee820..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumer.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-using MessageCallBack = RocketMQ.Driver.Interop.PushConsumerWrap.MessageCallBack;
-
-namespace RocketMQ.Driver.Consumer
-{
- public interface IPushConsumer
- {
- bool StartPushConsumer();
-
- bool ShutdownPushConsumer();
-
- void Subscribe(string topic, string expression);
-
- bool RegisterMessageCallback(MessageCallBack callBack);
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumerBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumerBuilder.cs
deleted file mode 100644
index b9c4de1..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/IPushConsumerBuilder.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace RocketMQ.Driver.Consumer
-{
- public interface IPushConsumerBuilder : IDisposable
- {
- IPushConsumerBuilder SetPushConsumerGroupId(string groupId);
-
- IPushConsumerBuilder SetPushConsumerNameServerAddress(string nameServerAddress);
-
- IPushConsumerBuilder SetPushConsumerNameServerDomain(string domain);
-
- IPushConsumerBuilder SetPushConsumerThreadCount(int threadCount);
-
- IPushConsumerBuilder SetPushConsumerMessageBatchMaxSize(int batchSize);
-
- IPushConsumerBuilder SetPushConsumerInstanceName(string instanceName);
-
- IPushConsumerBuilder SetPushConsumerSessionCredentials(string accessKey, string secretKey, string channel);
-
- IPushConsumerBuilder SetPushConsumerLogPath(string logPath);
-
- IPushConsumerBuilder SetPushConsumerLogLevel(LogLevel level);
-
- IPushConsumerBuilder SetPushConsumerLogFileNumAndSize(int fileNum, long fileSize);
-
- IPushConsumerBuilder SetPushConsumerMessageModel(MessageModel messageModel);
-
- IPushConsumer Build();
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/Internal/DefaultPushConsumer.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/Internal/DefaultPushConsumer.cs
deleted file mode 100644
index b10963d..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/Internal/DefaultPushConsumer.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using RocketMQ.Driver.Interop;
-
-namespace RocketMQ.Driver.Consumer.Internal
-{
- internal class DefaultPushConsumer : IPushConsumer, IDisposable
- {
- private HandleRef _handleRef;
-
- public DefaultPushConsumer(IntPtr handle)
- {
- this._handleRef = new HandleRef(this, handle);
- }
-
- public bool StartPushConsumer()
- {
- var startResult = PushConsumerWrap.StartPushConsumer(this._handleRef);
-
- return startResult == 0;
- }
-
- public bool ShutdownPushConsumer()
- {
- if (this._handleRef.Handle == IntPtr.Zero)
- {
- return false;
- }
-
- var shutdownResult = PushConsumerWrap.ShutdownPushConsumer(this._handleRef);
-
- return shutdownResult == 0;
- }
-
- public void Subscribe(string topic, string expression)
- {
- if (string.IsNullOrWhiteSpace(topic))
- {
- throw new ArgumentNullException(nameof(topic));
- }
-
- if (string.IsNullOrWhiteSpace(expression))
- {
- throw new ArgumentNullException(nameof(expression));
- }
-
- var result = PushConsumerWrap.Subscribe(this._handleRef, topic, expression);
-
- if (result != 0)
- {
- throw new RocketMQConsumerException($"push consumer subscribe error. cpp sdk return code: {result}");
- }
- }
-
- public bool RegisterMessageCallback(PushConsumerWrap.MessageCallBack callBack)
- {
- if (callBack == null)
- {
- return false;
- }
-
- var registerCallbackResult = PushConsumerWrap.RegisterMessageCallback(this._handleRef, callBack);
-
- return registerCallbackResult == 0;
- }
-
- public void Dispose()
- {
- if (this._handleRef.Handle != IntPtr.Zero)
- {
- PushConsumerWrap.DestroyPushConsumer(this._handleRef);
- this._handleRef = new HandleRef(null, IntPtr.Zero);
- GC.SuppressFinalize(this);
- }
- }
-
- ~DefaultPushConsumer()
- {
- this.Dispose();
- }
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/MessageModel.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/MessageModel.cs
deleted file mode 100644
index 94a4908..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/MessageModel.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-namespace RocketMQ.Driver.Consumer
-{
- public enum MessageModel
- {
- Broadcasting = 0,
-
- Clustering = 1
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/RocketMQConsumerException.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/RocketMQConsumerException.cs
deleted file mode 100644
index d10eec2..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Consumer/RocketMQConsumerException.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace RocketMQ.Driver.Consumer
-{
- public class RocketMQConsumerException : Exception
- {
- public RocketMQConsumerException(string message) : base(message)
- {
-
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ConstValues.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ConstValues.cs
deleted file mode 100644
index 6d13545..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ConstValues.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-namespace RocketMQ.Driver.Interop
-{
- public static class ConstValues
- {
- public const string RocketMQDriverDllName = "rocketmq-client-cpp.dll";
-
- public const string DiagnosticListenerName = "rocketmq-driver";
-
- public const string RocketMQProducerStart = "rocketmq.producer.start";
-
- public const string RocketMQProducerStop = "rocketmq.producer.stop";
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/MessageWrap.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/MessageWrap.cs
deleted file mode 100644
index f07e3a1..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/MessageWrap.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace RocketMQ.Driver.Interop
-{
- public static class MessageWrap
- {
- // create message
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern IntPtr CreateMessage(string topic);
-
- // set message
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int DestroyMessage(HandleRef message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetMessageTopic(HandleRef message, string topic);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetMessageTags(HandleRef message, string tags);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetMessageKeys(HandleRef message, string keys);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetMessageBody(HandleRef message, string body);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetByteMessageBody(HandleRef message, string body, int len);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetMessageProperty(HandleRef message, string key, string value);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetDelayTimeLevel(HandleRef message, int level);
-
- // get message
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPTStr)]
- public static extern string GetMessageTopic(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPTStr)]
- public static extern string GetMessageTags(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPTStr)]
- public static extern string GetMessageKeys(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPStr)]
- public static extern string GetMessageBody(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPStr)]
- public static extern string GetMessageProperty(IntPtr message, string key);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- [return: MarshalAs(UnmanagedType.LPStr)]
- public static extern string GetMessageId(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetMessageDelayTimeLevel(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetMessageQueueId(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetMessageReconsumeTimes(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int GetMessageStoreSize(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern long GetMessageBornTimestamp(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern long GetMessageStoreTimestamp(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern long GetMessageQueueOffset(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern long GetMessageCommitLogOffset(IntPtr message);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern long GetMessagePreparedTransactionOffset(IntPtr message);
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ProducerWrap.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ProducerWrap.cs
deleted file mode 100644
index c14ee3a..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/ProducerWrap.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace RocketMQ.Driver.Interop
-{
- public static class ProducerWrap
- {
- // init
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern IntPtr CreateProducer(string groupId);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int StartProducer(HandleRef producer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int ShutdownProducer(HandleRef producer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int DestroyProducer(HandleRef producer);
-
- // set parameters
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerNameServerAddress(HandleRef producer, string nameServer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerNameServerDomain(HandleRef producer, string domain);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerGroupName(HandleRef producer, string groupName);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerInstanceName(HandleRef producer, string instanceName);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerSessionCredentials(HandleRef producer, string accessKey, string secretKey, string onsChannel);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerLogPath(HandleRef producer, string logPath);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerLogFileNumAndSize(HandleRef producer, int fileNum, long fileSize);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerLogLevel(HandleRef producer, CLogLevel level);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerSendMsgTimeout(HandleRef producer, int timeout);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerCompressLevel(HandleRef producer, int level);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetProducerMaxMessageSize(HandleRef producer, int size);
-
- //send
-
- [DllImport(ConstValues.RocketMQDriverDllName,CallingConvention = CallingConvention.Cdecl)]
- public static extern int SendMessageSync(HandleRef producer, HandleRef message, [Out]out CSendResult result);
-
- [DllImport(ConstValues.RocketMQDriverDllName,CallingConvention = CallingConvention.Cdecl)]
- public static extern int SendMessageAsync(
- HandleRef producer,
- HandleRef message,
- [MarshalAs(UnmanagedType.FunctionPtr)]
- CSendSuccessCallback cSendSuccessCallback,
- [MarshalAs(UnmanagedType.FunctionPtr)]
- CSendExceptionCallback cSendExceptionCallback
- );
-
- [DllImport(ConstValues.RocketMQDriverDllName,CallingConvention = CallingConvention.Cdecl)]
- public static extern int SendMessageOneway(HandleRef producer, HandleRef message);
-
- /// <summary>
- /// 顺序发送消息。
- /// </summary>
- /// <param name="producer"></param>
- /// <param name="message"></param>
- /// <param name="callback"></param>
- /// <param name="arg">不能为 HandleRef.Zero, CPP SDK 做了检查。</param>
- /// <param name="autoRetryTimes"></param>
- /// <param name="result"></param>
- /// <returns></returns>
- [DllImport(ConstValues.RocketMQDriverDllName,CallingConvention = CallingConvention.Cdecl)]
- public static extern int SendMessageOrderly(
- HandleRef producer,
- HandleRef message,
- [MarshalAs(UnmanagedType.FunctionPtr)]
- QueueSelectorCallback callback,
- IntPtr arg,
- int autoRetryTimes,
- [Out]
- out CSendResult result
- );
-
- public delegate void CSendSuccessCallback(CSendResult result);
-
- public delegate void CSendExceptionCallback(CMQException e);
-
- public delegate int QueueSelectorCallback(int size, IntPtr message, IntPtr args);
- }
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- public struct CSendResult
- {
- public int sendStatus;
-
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
- public string msgId;
-
- public long offset;
- }
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- public struct CMQException
- {
- public int error;
-
- public int line;
-
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
- public string file;
-
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
- public string msg;
-
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
- public string type;
- }
-
- public enum CLogLevel
- {
- E_LOG_LEVEL_FATAL = 1,
-
- E_LOG_LEVEL_ERROR = 2,
-
- E_LOG_LEVEL_WARN = 3,
-
- E_LOG_LEVEL_INFO = 4,
-
- E_LOG_LEVEL_DEBUG = 5,
-
- E_LOG_LEVEL_TRACE = 6,
-
- E_LOG_LEVEL_LEVEL_NUM = 7
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/PushConsumerWrap.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/PushConsumerWrap.cs
deleted file mode 100644
index a07a7a1..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Interop/PushConsumerWrap.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace RocketMQ.Driver.Interop
-{
- public static class PushConsumerWrap
- {
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern IntPtr CreatePushConsumer(string groupId);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int DestroyPushConsumer(HandleRef consumer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int StartPushConsumer(HandleRef consumer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int ShutdownPushConsumer(HandleRef consumer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerGroupID(HandleRef consumer, string groupId);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "GetPushConsumerGroupID")]
- internal static extern IntPtr GetPushConsumerGroupIDInternal(IntPtr consumer);
-
- public static string GetPushConsumerGroupID(IntPtr consumer)
- {
- var ptr = GetPushConsumerGroupIDInternal(consumer);
- if (ptr == IntPtr.Zero) return string.Empty;
- return Marshal.PtrToStringAnsi(ptr);
- }
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerNameServerAddress(HandleRef consumer, string namesrv);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerNameServerDomain(HandleRef consumer, string domain);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int Subscribe(HandleRef consumer, string topic, string expression);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int RegisterMessageCallbackOrderly(
- IntPtr consumer,
- [MarshalAs(UnmanagedType.FunctionPtr)]
- MessageCallBack pCallback
- );
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int RegisterMessageCallback(
- HandleRef consumer,
- [MarshalAs(UnmanagedType.FunctionPtr)]
- MessageCallBack pCallback
- );
-
- public delegate int MessageCallBack(IntPtr consumer, IntPtr messageIntPtr);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int UnregisterMessageCallbackOrderly(IntPtr consumer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int UnregisterMessageCallback(IntPtr consumer);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerThreadCount(HandleRef consumer, int threadCount);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerMessageBatchMaxSize(HandleRef consumer, int batchSize);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerInstanceName(HandleRef consumer, string instanceName);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerSessionCredentials(HandleRef consumer, string accessKey, string secretKey, string channel);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerLogPath(HandleRef consumer, string logPath);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerLogFileNumAndSize(HandleRef consumer, int fileNum, long fileSize);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerLogLevel(HandleRef consumer, CLogLevel level);
-
- [DllImport(ConstValues.RocketMQDriverDllName, CallingConvention = CallingConvention.Cdecl)]
- public static extern int SetPushConsumerMessageModel(HandleRef consumer, CMessageModel messageModel);
- }
-
- public enum CMessageModel
- {
- BROADCASTING = 0,
-
- CLUSTERING = 1
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/LogLevel.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/LogLevel.cs
deleted file mode 100644
index bc0e23c..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/LogLevel.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-namespace RocketMQ.Driver
-{
- public enum LogLevel
- {
- None = 0,
-
- Fatal = 1,
-
- Error = 2,
-
- Warn = 3,
-
- Info = 4,
-
- Debug = 5,
-
- Trace = 6,
-
- LevelNum = 7
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultMessageBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultMessageBuilder.cs
deleted file mode 100644
index de17fee..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultMessageBuilder.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-using RocketMQ.Driver.Interop;
-
-namespace RocketMQ.Driver.Producer
-{
- public class DefaultMessageBuilder : IMessageBuilder
- {
- private HandleRef _handleRef;
-
- public DefaultMessageBuilder(string topic)
- {
- if (string.IsNullOrWhiteSpace(topic))
- {
- throw new ArgumentException(nameof(topic));
- }
-
- var handle = MessageWrap.CreateMessage(topic);
- this._handleRef = new HandleRef(this, handle);
-
- var result = MessageWrap.SetMessageTopic(this._handleRef, topic);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message topic error. cpp sdk return code: {result}");
- }
- }
-
- public IMessageBuilder SetMessageTopic(string topic)
- {
- if (string.IsNullOrWhiteSpace(topic))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(topic));
- }
-
- var result = MessageWrap.SetMessageTopic(this._handleRef, topic);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message topic error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetMessageTags(string tags)
- {
- if (string.IsNullOrWhiteSpace(tags))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(tags));
- }
-
- var result = MessageWrap.SetMessageTags(this._handleRef, tags);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message tags error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetMessageKeys(string keys)
- {
- if (string.IsNullOrWhiteSpace(keys))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(keys));
- }
-
- var result = MessageWrap.SetMessageKeys(this._handleRef, keys);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message keys error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetMessageBody(string body)
- {
- if (string.IsNullOrWhiteSpace(body))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(body));
- }
-
- var result = MessageWrap.SetMessageBody(this._handleRef, body);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message body error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetByteMessageBody(byte[] body)
- {
- if (body == null || body.Length == 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(body));
- }
-
- var byteBody = Encoding.UTF8.GetString(body);
- var result = MessageWrap.SetByteMessageBody(this._handleRef, byteBody, byteBody.Length);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message body error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetMessageProperty(string key, string value)
- {
- if (string.IsNullOrWhiteSpace(key))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(key));
- }
- if (string.IsNullOrWhiteSpace(value))
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentException(nameof(value));
- }
-
- var result = MessageWrap.SetMessageProperty(this._handleRef, key, value);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set message property error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IMessageBuilder SetDelayTimeLevel(int level)
- {
- if (level < 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new ArgumentOutOfRangeException(nameof(level));
- }
-
- var result = MessageWrap.SetDelayTimeLevel(this._handleRef, level);
- if (result != 0)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- throw new Exception($"set delay time level error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public HandleRef Build()
- {
- return this._handleRef;
- }
-
- public void Dispose()
- {
- if (this._handleRef.Handle != IntPtr.Zero)
- {
- MessageWrap.DestroyMessage(this._handleRef);
- this._handleRef = new HandleRef(null, IntPtr.Zero);
- GC.SuppressFinalize(this);
- }
- }
-
- ~DefaultMessageBuilder()
- {
- this.Dispose();
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultProducerBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultProducerBuilder.cs
deleted file mode 100644
index 93d39a9..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/DefaultProducerBuilder.cs
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using RocketMQ.Driver.Producer.Internal;
-
-namespace RocketMQ.Driver.Producer
-{
- internal class DefaultProducerBuilder : IProducerBuilder
- {
- private readonly ProducerOptions _options;
- private readonly DiagnosticListener _diagnosticListener;
- private readonly IProducerNativeMethodsFacade _producerFacade;
-
- private HandleRef _handleRef;
-
- public DefaultProducerBuilder(string groupName, IProducerNativeMethodsFacade producerFacade = null, DiagnosticListener diagnosticListener = null)
- {
- if (string.IsNullOrWhiteSpace(groupName))
- {
- throw new ArgumentNullException(nameof(groupName));
- }
-
- this._options = new ProducerOptions {
- GroupName = groupName
- };
- this._producerFacade = producerFacade ?? new ProducerNativeMethodsFacade();
- this._diagnosticListener = diagnosticListener;
-
- var handle = this._producerFacade.CreateProducer(groupName);
-
- if (handle == IntPtr.Zero)
- {
- throw new RocketMQProducerException($"create producer error, ptr is {handle}");
- }
-
- this._handleRef = new HandleRef(this, handle);
- }
-
- public IProducerBuilder SetProducerNameServerAddress(string nameServerAddress)
- {
- if (string.IsNullOrWhiteSpace(nameServerAddress))
- {
- throw new ArgumentException(nameof(nameServerAddress));
- }
-
- this._options.NameServerAddress = nameServerAddress;
-
- var result = this._producerFacade.SetProducerNameServerAddress(this._handleRef, nameServerAddress);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer nameServerAddress error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerNameServerDomain(string nameServerDomain)
- {
- if (string.IsNullOrWhiteSpace(nameServerDomain))
- {
- throw new ArgumentException(nameof(nameServerDomain));
- }
-
- this._options.NameServerDomain = nameServerDomain;
-
- var result = this._producerFacade.SetProducerNameServerDomain(this._handleRef, nameServerDomain);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer nameServerDomain error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerGroupName(string groupName)
- {
- if (string.IsNullOrWhiteSpace(groupName))
- {
- throw new ArgumentException(nameof(groupName));
- }
-
- this._options.GroupName = groupName;
-
- var result = this._producerFacade.SetProducerGroupName(this._handleRef, groupName);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer groupName error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerInstanceName(string instanceName)
- {
- if (string.IsNullOrWhiteSpace(instanceName))
- {
- throw new ArgumentException(nameof(instanceName));
- }
-
- this._options.InstanceName = instanceName;
-
- var result = this._producerFacade.SetProducerInstanceName(this._handleRef, instanceName);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer instanceName error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerSessionCredentials(string accessKey, string secretKey, string onsChannel)
- {
- if (string.IsNullOrWhiteSpace(accessKey))
- {
- throw new ArgumentException(nameof(accessKey));
- }
- if (string.IsNullOrWhiteSpace(secretKey))
- {
- throw new ArgumentException(nameof(secretKey));
- }
- if (string.IsNullOrWhiteSpace(onsChannel))
- {
- throw new ArgumentException(nameof(onsChannel));
- }
-
- this._options.AccessKey = accessKey;
- this._options.SecretKey = secretKey;
- this._options.Channel = onsChannel;
-
- var result = this._producerFacade.SetProducerSessionCredentials(this._handleRef, accessKey, secretKey, onsChannel);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer sessionCredentials error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerLogPath(string logPath)
- {
- if (string.IsNullOrWhiteSpace(logPath))
- {
- throw new ArgumentException(nameof(logPath));
- }
-
- this._options.LogPath = logPath;
-
- var result = this._producerFacade.SetProducerLogPath(this._handleRef, logPath);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer logPath error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerLogFileNumAndSize(int fileNum, long fileSize)
- {
- if (fileNum <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(fileNum));
- }
-
- if (fileSize <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(fileSize));
- }
-
- this._options.LogFileNum = fileNum;
- this._options.LogFileSize = fileSize;
-
- var result = this._producerFacade.SetProducerLogFileNumAndSize(this._handleRef, fileNum, fileSize);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer logFileNumAndSize error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerLogLevel(LogLevel logLevel)
- {
- if (logLevel == LogLevel.None)
- {
- throw new ArgumentException(nameof(logLevel));
- }
-
- this._options.LogLevel = logLevel;
-
- var result = this._producerFacade.SetProducerLogLevel(this._handleRef, logLevel);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer logLevel error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerSendMessageTimeout(int timeout)
- {
- if (timeout < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(timeout));
- }
-
- this._options.SendMessageTimeout = timeout;
-
- var result = this._producerFacade.SetProducerSendMsgTimeout(this._handleRef, timeout);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer sendMessageTimeout error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerCompressLevel(int level)
- {
- if (level < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(level));
- }
-
- this._options.CompressLevel = level;
-
- var result = this._producerFacade.SetProducerCompressLevel(this._handleRef, level);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer compressLevel error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducerBuilder SetProducerMaxMessageSize(int size)
- {
- if (size < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(size));
- }
-
- this._options.MaxMessageSize = size;
-
- var result = this._producerFacade.SetProducerMaxMessageSize(this._handleRef, size);
- if (result != 0)
- {
- throw new RocketMQProducerException($"set producer maxMessageSize error. cpp sdk return code: {result}");
- }
-
- return this;
- }
-
- public IProducer Build()
- {
- if (string.IsNullOrWhiteSpace(this._options.GroupName))
- {
- throw new ArgumentNullException(nameof(this._options.GroupName));
- }
-
- var producer = new DefaultProducer(this._options, this._handleRef.Handle, this._producerFacade, this._diagnosticListener);
- this._handleRef = new HandleRef(null, IntPtr.Zero);
-
- return producer;
- }
-
- public void Dispose()
- {
- if (this._handleRef.Handle != IntPtr.Zero)
- {
- this._handleRef = new HandleRef(null, IntPtr.Zero);
- GC.SuppressFinalize(this);
- }
- }
-
- ~DefaultProducerBuilder()
- {
- this.Dispose();
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IMessageBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IMessageBuilder.cs
deleted file mode 100644
index e73beae..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IMessageBuilder.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace RocketMQ.Driver.Producer
-{
- public interface IMessageBuilder : IDisposable
- {
- IMessageBuilder SetMessageTopic(string topic);
-
- IMessageBuilder SetMessageTags(string tags);
-
- IMessageBuilder SetMessageKeys(string keys);
-
- IMessageBuilder SetMessageBody(string body);
-
- IMessageBuilder SetByteMessageBody(byte[] body);
-
- IMessageBuilder SetMessageProperty(string key, string value);
-
- IMessageBuilder SetDelayTimeLevel(int level);
-
- HandleRef Build();
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducer.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducer.cs
deleted file mode 100644
index 25d3fc9..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using QueueSelectorCallback = RocketMQ.Driver.Interop.ProducerWrap.QueueSelectorCallback;
-
-namespace RocketMQ.Driver.Producer
-{
- public interface IProducer : IDisposable
- {
- /// <summary>
- /// 获取 producer 的 native 句柄。
- /// </summary>
- HandleRef Handle { get; }
-
- ProducerOptions Options { get; }
-
- bool StartProducer();
-
- bool ShutdownProducer();
-
- void SetDiagnosticListener(DiagnosticListener diagnosticListener);
-
- SendResult SendMessageSync(IMessageBuilder builder);
-
- SendResult SendMessageOneway(IMessageBuilder builder);
-
- SendResult SendMessageOrderly(IMessageBuilder builder, QueueSelectorCallback callback, int autoRetryTimes = 0, string args = "");
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducerBuilder.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducerBuilder.cs
deleted file mode 100644
index ad567e3..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/IProducerBuilder.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace RocketMQ.Driver.Producer
-{
- public interface IProducerBuilder : IDisposable
- {
- IProducerBuilder SetProducerNameServerAddress(string nameServerAddress);
-
- IProducerBuilder SetProducerNameServerDomain(string nameServerDomain);
-
- IProducerBuilder SetProducerGroupName(string groupName);
-
- IProducerBuilder SetProducerInstanceName(string instanceName);
-
- IProducerBuilder SetProducerSessionCredentials(string accessKey, string secretKey, string onsChannel);
-
- IProducerBuilder SetProducerLogPath(string logPath);
-
- IProducerBuilder SetProducerLogFileNumAndSize(int fileNum, long fileSize);
-
- IProducerBuilder SetProducerLogLevel(LogLevel level);
-
- IProducerBuilder SetProducerSendMessageTimeout(int timeout);
-
- IProducerBuilder SetProducerCompressLevel(int level);
-
- IProducerBuilder SetProducerMaxMessageSize(int size);
-
- IProducer Build();
- }
-
- public class ProducerOptions
- {
- public string NameServerAddress { get; internal set; }
-
- public string NameServerDomain { get; internal set; }
-
- public string GroupName { get; internal set; }
-
- public string InstanceName { get; internal set; }
-
- public string AccessKey { get; internal set; }
-
- public string SecretKey { get; internal set; }
-
- public string Channel { get; internal set; }
-
- public string LogPath { get; internal set; }
-
- public int LogFileNum { get; internal set; }
-
- public long LogFileSize { get; internal set; }
-
- public LogLevel LogLevel { get; internal set; }
-
- public int SendMessageTimeout { get; internal set; }
-
- public int CompressLevel { get; internal set; }
-
- public int MaxMessageSize { get; internal set; }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/DefaultProducer.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/DefaultProducer.cs
deleted file mode 100644
index f19705d..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/DefaultProducer.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using RocketMQ.Driver.Interop;
-using QueueSelectorCallback = RocketMQ.Driver.Interop.ProducerWrap.QueueSelectorCallback;
-
-namespace RocketMQ.Driver.Producer.Internal
-{
- internal class DefaultProducer : IProducer
- {
- private readonly IProducerNativeMethodsFacade _producerFacade;
- private DiagnosticListener _diagnosticListener;
-
- public HandleRef Handle { get; private set; }
-
- public ProducerOptions Options { get; }
-
- public DefaultProducer(ProducerOptions options, IntPtr handle, IProducerNativeMethodsFacade producerFacade = null, DiagnosticListener diagnosticListener = null)
- {
- this.Options = options ?? throw new ArgumentNullException(nameof(options));
-
- if (handle == IntPtr.Zero)
- {
- throw new ArgumentOutOfRangeException(nameof(handle));
- }
-
- this.Handle = new HandleRef(this, handle);
- this._producerFacade = producerFacade ?? new ProducerNativeMethodsFacade();
- this._diagnosticListener = diagnosticListener;
- }
-
- public bool StartProducer()
- {
- var startResult = this._producerFacade.StartProducer(this.Handle);
-
- if (this._diagnosticListener?.IsEnabled(ConstValues.RocketMQProducerStart) ?? false)
- {
- this._diagnosticListener.Write(ConstValues.RocketMQProducerStart, new {
- startResult
- });
- }
-
- return startResult == 0;
- }
-
- public bool ShutdownProducer()
- {
- var shutdownResult = ProducerWrap.ShutdownProducer(this.Handle);
-
- if (this._diagnosticListener?.IsEnabled(ConstValues.RocketMQProducerStop) ?? false)
- {
- this._diagnosticListener.Write(ConstValues.RocketMQProducerStop, new {
- shutdownResult
- });
- }
-
- return shutdownResult == 0;
- }
-
- public void SetDiagnosticListener(DiagnosticListener diagnosticListener)
- {
- this._diagnosticListener = diagnosticListener;
- }
-
- public SendResult SendMessageSync(IMessageBuilder builder)
- {
- var message = builder.Build();
- if (message.Handle == IntPtr.Zero)
- {
- throw new ArgumentException(nameof(builder));
- }
-
- var result = ProducerWrap.SendMessageSync(this.Handle, message, out var sendResult);
-
- return result == 0
- ? new SendResult {
- SendStatus = sendResult.sendStatus,
- Offset = sendResult.offset,
- MessageId = sendResult.msgId
- }
- : null;
- }
-
- public SendResult SendMessageOneway(IMessageBuilder builder)
- {
- var message = builder.Build();
- if (message.Handle == IntPtr.Zero)
- {
- throw new ArgumentException(nameof(builder));
- }
-
- var result = ProducerWrap.SendMessageOneway(this.Handle, message);
-
- return result == 0
- ? new SendResult {
- SendStatus = result,
- Offset = 0,
- MessageId = string.Empty
- }
- : null;
- }
-
- public SendResult SendMessageOrderly(IMessageBuilder builder, QueueSelectorCallback callback, int autoRetryTimes = 0, string args = "")
- {
- var message = builder.Build();
- if (message.Handle == IntPtr.Zero)
- {
- throw new ArgumentException(nameof(builder));
- }
-
- var argsPtr = Marshal.StringToBSTR(args);
- var result = ProducerWrap.SendMessageOrderly(this.Handle, message, callback, argsPtr, autoRetryTimes, out var sendResult);
-
- return result == 0
- ? new SendResult {
- SendStatus = sendResult.sendStatus,
- Offset = sendResult.offset,
- MessageId = sendResult.msgId
- }
- : null;
- }
-
- public void Dispose()
- {
- if (this.Handle.Handle != IntPtr.Zero)
- {
- ProducerWrap.DestroyProducer(this.Handle);
- this.Handle = new HandleRef(null, IntPtr.Zero);
- GC.SuppressFinalize(this);
- }
- }
-
- ~DefaultProducer()
- {
- this.Dispose();
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/IProducerNativeMethodsFacade.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/IProducerNativeMethodsFacade.cs
deleted file mode 100644
index 488de65..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/IProducerNativeMethodsFacade.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace RocketMQ.Driver.Producer.Internal
-{
- public interface IProducerNativeMethodsFacade
- {
- // sets
- IntPtr CreateProducer(string groupId);
-
- int StartProducer(HandleRef producer);
-
- int SetProducerNameServerAddress(HandleRef producer, string nameServer);
-
- int SetProducerNameServerDomain(HandleRef producer, string domain);
-
- int SetProducerGroupName(HandleRef producer, string groupName);
-
- int SetProducerInstanceName(HandleRef producer, string instanceName);
-
- int SetProducerSessionCredentials(HandleRef producer, string accessKey, string secretKey, string onsChannel);
-
- int SetProducerLogPath(HandleRef producer, string logPath);
-
- int SetProducerLogFileNumAndSize(HandleRef producer, int fileNum, long fileSize);
-
- int SetProducerLogLevel(HandleRef producer, LogLevel level);
-
- int SetProducerSendMsgTimeout(HandleRef producer, int timeout);
-
- int SetProducerCompressLevel(HandleRef producer, int level);
-
- int SetProducerMaxMessageSize(HandleRef producer, int size);
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/ProducerNativeMethodsFacade.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/ProducerNativeMethodsFacade.cs
deleted file mode 100644
index f559d95..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/Internal/ProducerNativeMethodsFacade.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using RocketMQ.Driver.Interop;
-
-namespace RocketMQ.Driver.Producer.Internal
-{
- internal class ProducerNativeMethodsFacade : IProducerNativeMethodsFacade
- {
- public IntPtr CreateProducer(string groupId)
- {
- return ProducerWrap.CreateProducer(groupId);
- }
-
- public int StartProducer(HandleRef producer)
- {
- return ProducerWrap.StartProducer(producer);
- }
-
- public int SetProducerNameServerAddress(HandleRef producer, string nameServer)
- {
- return ProducerWrap.SetProducerNameServerAddress(producer, nameServer);
- }
-
- public int SetProducerNameServerDomain(HandleRef producer, string domain)
- {
- return ProducerWrap.SetProducerNameServerDomain(producer, domain);
- }
-
- public int SetProducerGroupName(HandleRef producer, string groupName)
- {
- return ProducerWrap.SetProducerGroupName(producer, groupName);
- }
-
- public int SetProducerInstanceName(HandleRef producer, string instanceName)
- {
- return ProducerWrap.SetProducerInstanceName(producer, instanceName);
- }
-
- public int SetProducerSessionCredentials(HandleRef producer, string accessKey, string secretKey, string onsChannel)
- {
- return ProducerWrap.SetProducerSessionCredentials(producer, accessKey, secretKey, onsChannel);
- }
-
- public int SetProducerLogPath(HandleRef producer, string logPath)
- {
- return ProducerWrap.SetProducerLogPath(producer, logPath);
- }
-
- public int SetProducerLogFileNumAndSize(HandleRef producer, int fileNum, long fileSize)
- {
- return ProducerWrap.SetProducerLogFileNumAndSize(producer, fileNum, fileSize);
- }
-
- public int SetProducerLogLevel(HandleRef producer, LogLevel level)
- {
- return ProducerWrap.SetProducerLogLevel(producer, (CLogLevel) level);
- }
-
- public int SetProducerSendMsgTimeout(HandleRef producer, int timeout)
- {
- return ProducerWrap.SetProducerSendMsgTimeout(producer, timeout);
- }
-
- public int SetProducerCompressLevel(HandleRef producer, int level)
- {
- return ProducerWrap.SetProducerCompressLevel(producer, level);
- }
-
- public int SetProducerMaxMessageSize(HandleRef producer, int size)
- {
- return ProducerWrap.SetProducerMaxMessageSize(producer, size);
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/RocketMQProducerException.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/RocketMQProducerException.cs
deleted file mode 100644
index f5c916d..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/RocketMQProducerException.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace RocketMQ.Driver.Producer
-{
- public class RocketMQProducerException : Exception
- {
- public RocketMQProducerException(string message) : base(message)
- {
-
- }
- }
-}
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/SendResult.cs b/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/SendResult.cs
deleted file mode 100644
index 31b2d58..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/Producer/SendResult.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-namespace RocketMQ.Driver.Producer
-{
- public class SendResult
- {
- public int SendStatus { get; set; }
-
- public string MessageId { get; set; }
-
- public long Offset { get; set; }
- }
-}
\ No newline at end of file
diff --git a/rocketmq-client-dotnet/src/RocketMQ.Driver/RocketMQ.Driver.csproj b/rocketmq-client-dotnet/src/RocketMQ.Driver/RocketMQ.Driver.csproj
deleted file mode 100644
index c4c816d..0000000
--- a/rocketmq-client-dotnet/src/RocketMQ.Driver/RocketMQ.Driver.csproj
+++ /dev/null
@@ -1,11 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="Microsoft.Extensions.DiagnosticAdapter" Version="2.2.0" />
- </ItemGroup>
-
-</Project>
diff --git a/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/RocketMQ.Driver.Test.csproj b/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/RocketMQ.Driver.Test.csproj
deleted file mode 100644
index 4ec64e7..0000000
--- a/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/RocketMQ.Driver.Test.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>netcoreapp2.1</TargetFramework>
-
- <IsPackable>false</IsPackable>
- </PropertyGroup>
-
- <ItemGroup>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
- <PackageReference Include="xunit" Version="2.4.0" />
- <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
- </ItemGroup>
-
-</Project>
diff --git a/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/UnitTest1.cs b/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/UnitTest1.cs
deleted file mode 100644
index 26b07e6..0000000
--- a/rocketmq-client-dotnet/test/RocketMQ.Driver.Test/UnitTest1.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Xunit;
-
-namespace RocketMQ.Driver.Test
-{
- public class UnitTest1
- {
- [Fact]
- public void Test1()
- {
-
- }
- }
-}
diff --git a/rocketmq-client-php/.gitignore b/rocketmq-client-php/.gitignore
deleted file mode 100644
index 9d22eb4..0000000
--- a/rocketmq-client-php/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.o
-*.so
diff --git a/rocketmq-client-php/LICENSE b/rocketmq-client-php/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/rocketmq-client-php/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
diff --git a/rocketmq-client-php/Makefile b/rocketmq-client-php/Makefile
deleted file mode 100644
index 318dff9..0000000
--- a/rocketmq-client-php/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#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.
-
-
-
-CPP = g++
-RM = rm -f
-CPP_FLAGS = -Wall -c -I. -O2 -std=c++11
-
-LIBRARY_DIR = `php-config --extension-dir`
-
-LD = g++
-LD_FLAGS = -Wall -shared -O2
-RESULT = rocketmq.so
-
-DIR_SRC = ./src
-
-SOURCES = $(wildcard ${DIR_SRC}/*.cc)
-OBJECTS = $(SOURCES:%.cc=%.o)
-
-all: ${OBJECTS} ${RESULT}
-
-${RESULT}: ${OBJECTS}
- ${LD} ${LD_FLAGS} -o $@ ${OBJECTS} -lphpcpp -lrocketmq -lz -lcurl -lpthread
-
-
-${OBJECTS}:
- ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cc}
-
-install:
- cp -f ${RESULT} ${LIBRARY_DIR}
-
-clean:
- ${RM} *.obj *~* ${OBJECTS} ${RESULT}
diff --git a/rocketmq-client-php/README.md b/rocketmq-client-php/README.md
deleted file mode 100644
index 0352d4d..0000000
--- a/rocketmq-client-php/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# rocketmq-client-php
-
-A Php Client for Apache RocketMQ.
-
-# dependence
-* [rocketmq-client-cpp](https://github.com/apache/rocketmq-client-cpp)
-* [PHP-CPP](https://github.com/CopernicaMarketingSoftware/PHP-CPP)
-* php7
-
-## INSTALL
-1. install rocketmq-client-cpp
-2. install php-cpp
-3. download rocketmq-client-php
-```shell
- git clone https://github.com/lpflpf/rocketmq-client-php;
- cd rocketmq-client-php;
- make && make install
-```
-4. update php.ini file, add line `extension=rocketmq.so`;
-5. try to run example in example directory.
-
-## Usage
- to see autocompelete file.
-
-## Example
-
-### Producer Example
-
-```php
-namespace RocketMQ;
-$instanceName = "MessageQueue";
-
-$producer = new Producer($instanceName);
-$producer->setInstanceName($instanceName);
-$producer->setNamesrvAddr("127.0.0.1:9876");
-$producer->start();
-
-for ($i = 0; $i < 10000; $i ++){
- $message = new Message("TopicTest", "*", "hello world $i");
- $sendResult = $producer->send($message);
- echo $sendResult->getSendStatus() . "\n";
-}
-```
-
-### PullConsumer Example
-
-It is a good idea to save offset in local.
-
-```php
-namespace RocketMQ;
-
-$consumer = new PullConsumer("pullTestGroup");
-$consumer->setInstanceName("testGroup");
-$consumer->setTopic("TopicTest");
-$consumer->setNamesrvAddr("127.0.0.1:9876");
-$consumer->start();
-$queues = $consumer->getQueues();
-
-foreach($queues as $queue){
- $newMsg = true;
- $offset = 0;
- while($newMsg){
- $pullResult = $consumer->pull($queue, "*", $offset, 8);
-
- switch ($pullResult->getPullStatus()){
- case PullStatus::FOUND:
- foreach($pullResult as $key => $val){
- echo $val->getMessage()->getBody() . "\n";
- }
- $offset += count($pullResult);
- break;
- default:
- $newMsg = false;
- break;
- }
- }
-}
-```
-
-### PushConsumer Example
-
-```php
-namespace RocketMQ;
-
-$consumer = new PushConsumer("testGroup");
-$consumer->setInstanceName("testGroup");
-$consumer->setNamesrvAddr("127.0.0.1:9876");
-$consumer->setThreadCount(10);
-$consumer->setListenerType(MessageListenerType::LISTENER_ORDERLY);
-$count = 0;
-$consumer->setCallback(function ($msg) use (&$count){
- echo $msg->getMessage()->getBody() . "\n";
- $count ++;
-});
-$consumer->subscribe("TopicTest", "*");
-$consumer->start();
-$consumer->shutdown();
-
-```
-## TODO
-
-1. Manual commit an offset.
-2. Log handle. ( specify log file is no support by rocketmq-client-cpp. )
-3. Doc.
diff --git a/rocketmq-client-php/autocomplete/ConsumeFromWhere.php b/rocketmq-client-php/autocomplete/ConsumeFromWhere.php
deleted file mode 100644
index 5525f16..0000000
--- a/rocketmq-client-php/autocomplete/ConsumeFromWhere.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class ConsumeFromWhere {
- const CONSUME_FROM_LAST_OFFSET = 0;
-
- /**
- * @deprecated
- */
-
- const CONSUME_FROM_LAST_OFFSET_AND_FROM_MIN_WHEN_BOOT_FIRST = 1;
-
- const CONSUME_FROM_MIN_OFFSET = 2;
- const CONSUME_FROM_MAX_OFFSET = 3;
-
- const CONSUME_FROM_FIRST_OFFSET = 4;
-
- const CONSUME_FROM_TIMESTAMP = 5;
-
-}
diff --git a/rocketmq-client-php/autocomplete/ConsumeStatus.php b/rocketmq-client-php/autocomplete/ConsumeStatus.php
deleted file mode 100644
index 9ac6898..0000000
--- a/rocketmq-client-php/autocomplete/ConsumeStatus.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class ConsumeStatus {
- const CONSUME_SUCCESS = 0;
- const RECONSUME_LATER = 1;
-}
diff --git a/rocketmq-client-php/autocomplete/ConsumeType.php b/rocketmq-client-php/autocomplete/ConsumeType.php
deleted file mode 100644
index ab5fc2c..0000000
--- a/rocketmq-client-php/autocomplete/ConsumeType.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class ConsumeType {
- const CONSUME_ACTIVELY = 0;
- const CONSUME_PASSIVELY = 1;
-}
diff --git a/rocketmq-client-php/autocomplete/Message.php b/rocketmq-client-php/autocomplete/Message.php
deleted file mode 100644
index 45d4346..0000000
--- a/rocketmq-client-php/autocomplete/Message.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class Message {
- public function __construct(string $topic, string $tags, string $body = "", string $keys){
- }
- public function setProperty(string $name, string $value){
- }
- public function getProperty(){
- }
- public function getTopic(){
- }
- public function setTopic(string $topic){
- }
- public function setTags(string $tags){
- }
- public function getKeys(){
- }
- public function setKeys(string $keys){
- }
- public function getDelayTimeLevel(){
- }
- public function setDelayTimeLevel(int $delayTimeLevel){
- }
- public function isWaitStoreMsgOK(){
- }
- public function setWaitStoreMsgOK(bool $waitStoreMsgOK){
- }
- public function getFlag(){
- }
- public function setFlag(int $flag){
- }
- public function getSysFlag(){
- }
- public function setSysFlag(int $sysFlag){
- }
- public function getBody(){
- }
- public function setBody(string $body){
- }
- public function getProperties(){
- }
- public function setProperties(array $properties){
- }
- public function toString(){
- }
-
-}
diff --git a/rocketmq-client-php/autocomplete/MessageExt.php b/rocketmq-client-php/autocomplete/MessageExt.php
deleted file mode 100644
index 5aba3eb..0000000
--- a/rocketmq-client-php/autocomplete/MessageExt.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class MessageExt{
-
- public function parseTopicFilterType(int $parseTopicFilterType){
- }
- public function getQueue(){
- }
- public function setQueueId(int $setQueueid){
- }
- public function getBornTimestamp(){
- }
- public function setBornTimestamp(int $bornTimestamp){
- }
- public function getStoreHostString(){
- }
- public function getMsgId(){
- }
- public function setMsgId(string $msgId){
- }
- public function getOffsetMsgId(){
- }
- public function setOffsetMsgId(int $offsetMsgId){
- }
- public function getBodyCRC(){
- }
- public function setBodyCRC(int $bodyCRC){
- }
- public function getQueueOffset(){
- }
- public function setQueueOffset(int $queueOffset){
- }
- public function getCommitLogOffset(){
- }
- public function setCommitLogOffset(int $physicOffset){
- }
- public function getStoreSize(){
- }
- public function setStoreSize(int $storeSize){
- }
- public function getReconsumeTimes(){
- }
- public function getPreparedTransactionOffset(){
- }
- public function setPreparedTransactionOffset(int $preparedTransactionOffset){
- }
- public function toString(){
- }
- public function getMessage(){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/MessageModel.php b/rocketmq-client-php/autocomplete/MessageModel.php
deleted file mode 100644
index fa9645a..0000000
--- a/rocketmq-client-php/autocomplete/MessageModel.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class MessageModel{
- const BROADCASTING = 0;
- const CLUSTERING = 1;
-}
-
diff --git a/rocketmq-client-php/autocomplete/MessageQueue.php b/rocketmq-client-php/autocomplete/MessageQueue.php
deleted file mode 100644
index dc31377..0000000
--- a/rocketmq-client-php/autocomplete/MessageQueue.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class MessageQueue{
- public function getTopic(){
- }
-
- public function setTopic(){
- }
-
- public function getBrokerName(){
- }
-
- public function setBrokerName(){
- }
-
- public function getQueueId(){
- }
-
- public function setQueueId(){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/Producer.php b/rocketmq-client-php/autocomplete/Producer.php
deleted file mode 100644
index 4204fbd..0000000
--- a/rocketmq-client-php/autocomplete/Producer.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class Producer {
- public function __construct(string $groupName){
- }
-
- public function getMQClientId(){
- }
-
- public function getInstanceName(){
- }
-
- public function setInstanceName(string $groupName){
- }
-
- public function getNamesrvAddr(){
- }
-
- public function setNamesrvAddr(string $nameserver){
- }
-
- public function setNamesrvDomain($nameserver){
- }
-
- public function getGroupName(){
- }
-
- public function setGroupName(string $groupName){
- }
-
- public function send(Message $message){
- }
-
- public function getSessionCredentials(){
- }
-
- public function setSessionCredentials(string $accessKey, string $secretKey, string $autChannel){
- }
-
- public function getTopicMessageQueueInfo(string $topic){
- }
-
- public function start(){
- }
-
- public function setRetryTimes(int $retryTimes){
- }
-
- public function getRetryTimes(){
- }
-
- public function getSendMsgTimeout(){
- }
-
- public function setSendMsgTimeout($sendMsgTimeout){
- }
-
- public function getCompressMsgBodyOverHowmuch(){
-
- }
-
- public function setCompressMsgBodyOverHowmuch($compressMsgBodyOverHowmuch){
- }
-
- // level = [-1, 9]
- public function getCompressLevel(){
- }
-
- // level = [-1, 9]
- public function setCompressLevel($compressLevel){
- }
-
- public function getMaxMessageSize(){
- }
-
- public function setMaxMessageSize($messageSize){
- }
-
- // default = cpu core.
- public function setTcpTransportPullThreadNum(int $num){
- }
-
- public function getTcpTransportPullThreadNum(){
- }
-
- // default = 3000 ms
- public function setTcpTransportConnectTimeout(int $timeout){
- }
-
- public function getTcpTransportConnectTimeout(){
- }
-
- // default 3000ms
- public function setTcpTransportTryLockTimeout(int $timeout){
- }
-
- public function getTcpTransportTryLockTimeout(){
- }
-
- // default unitName = ""
- public function setUnitName(string $unitName){
- }
-
- public function getUnitName(){
- }
-
- public function setLogLevel(int $inputLevel){
- }
-
- public function getLogLevel(){
- }
-
- public function setLogFileSizeAndNum($fileNum, $perFileSize){
- }
-}
-
diff --git a/rocketmq-client-php/autocomplete/PullConsumer.php b/rocketmq-client-php/autocomplete/PullConsumer.php
deleted file mode 100644
index 8fbde59..0000000
--- a/rocketmq-client-php/autocomplete/PullConsumer.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-/**
- * Pull method consumer.
- *
- */
-class PullConsumer{
- public function __construct(string $groupName){
- }
-
- public function setInstanceName($instanceName){
- }
-
- public function setNamesrvAddr($address){
- }
-
- public function getNamesrvAddr(){
- }
-
- public function setNamesrvDomain($nameserver){
- }
-
- public function getNamesrvDomain(){
- }
-
- public function setTopic($topic){
- }
-
- public function start(){
- }
-
- public function getQueues(){
- }
-
- public function setGroup(string $group){
- }
-
- public function pull(MessageQueue $messageQueue, string $subExpression, int $offset, int $maxNums){
- }
-
- public function pullBlockIfNotFound(MessageQueue $messageQueue, string $subExpression, int $offset, int $maxNums){
- }
-
- public function getSessionCredentials(){
- }
-
- public function setSessionCredentials(string $accessKey, string $secretKey, string $authChannel){
- }
-
- public function updateConsumeOffset(MessageQueue $messageQueue, int $offset){
- }
-
- public function removeConsumeOffset(MessageQueue $messageQueue){
- }
-
- public function fetchConsumeOffset(MessageQueue $messageQueue, string $fromStore){
- }
-
- public function setMessageModel($model){
- }
-
- public function getMessageModel($model){
- }
-
- public function setTcpTransportPullThreadNum(int $num){
- }
-
- public function getTcpTransportPullThreadNum(){
- }
-
- public function setTcpTransportConnectTimeout(int $timeout){
- }
-
- public function getTcpTransportConnectTimeout(){
- }
-
- public function setTcpTransportTryLockTimeout(int $timeout){
- }
-
- public function getTcpTransportTryLockTimeout(){
- }
-
- public function setUnitName(string $unitName){
- }
-
- public function getUnitName(){
- }
-
- public function getConsumeFromWhere(){
- }
-
- public function setConsumeFromWhere(int $consumeFromWhere){
- }
-
- public function setLogLevel(int $inputLevel){
- }
-
- public function getLogLevel(){
- }
-
- public function setLogFileSizeAndNum($fileNum, $perFileSize){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/PullResult.php b/rocketmq-client-php/autocomplete/PullResult.php
deleted file mode 100644
index fbfc994..0000000
--- a/rocketmq-client-php/autocomplete/PullResult.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class PullResult implements Countable, Iterator{
- public function getMessage($index){
- }
-
- public function getPullStatus(){
- }
-
- public function getNextBeginOffset(){
- }
-
- public function getMinOffset(){
- }
-
- public function getMaxOffset(){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/PullStatus.php b/rocketmq-client-php/autocomplete/PullStatus.php
deleted file mode 100644
index 394a013..0000000
--- a/rocketmq-client-php/autocomplete/PullStatus.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class PullStatus{
- const FOUND = 0;
- const NO_METCHED_MSG = 1;
- const OFFSET_ILLEGAL = 2;
- const BROKER_TIMEOUT = 3;
- const NO_NEW_MSG = 4;
-}
diff --git a/rocketmq-client-php/autocomplete/PushConsumer.php b/rocketmq-client-php/autocomplete/PushConsumer.php
deleted file mode 100644
index f935a01..0000000
--- a/rocketmq-client-php/autocomplete/PushConsumer.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class PushConsumer{
- public function setNamesrvDomain($nameserver){
- }
-
- public function getNamesrvDomain(){
- }
-
- public function setNamesrvAddr($nameserverAddr){
-
- }
- public function getNamesrvAddr(){
- }
-
- public function setInstanceName($groupName){
- }
-
- public function setTryLockTimeout($tryLockTimeout){
- }
-
- public function setConnectTimeout($connectTimeout){
- }
-
- public function setThreadCount($threadCount){
- }
-
- public function setListenerType($listenerType){
- }
-
- public function subscribe($topic, $tag){
- }
-
- public function start(){
- }
-
- public function shutdown(){
- }
-
- public function setCallback(callable $callback){
- }
-
- public function setMessageModel($model){
- }
-
- public function getMessageModel($model){
- }
-
- public function setTcpTransportPullThreadNum(int $num){
- }
-
- public function getTcpTransportPullThreadNum(){
- }
-
- public function setTcpTransportConnectTimeout(int $timeout){
- }
-
- public function getTcpTransportConnectTimeout(){
- }
-
- public function setTcpTransportTryLockTimeout(int $timeout){
- }
-
- public function getTcpTransportTryLockTimeout(){
- }
-
- public function setUnitName(string $unitName){
- }
-
- public function getUnitName(){
- }
-
- public function getConsumeFromWhere(){
- }
-
- public function setConsumeFromWhere(int $consumeFromWhere){
- }
-
- public function setLogLevel(int $inputLevel){
- }
-
- public function getLogLevel(){
- }
-
- public function setLogFileSizeAndNum($fileNum, $perFileSize){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/SendResult.php b/rocketmq-client-php/autocomplete/SendResult.php
deleted file mode 100644
index 07595a2..0000000
--- a/rocketmq-client-php/autocomplete/SendResult.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class SendResult{
- public function getMsgId(){
- }
- public function getOffsetMsgId(){
- }
- public function getSendStatus(){
- }
- public function getMessageQueue(){
- }
- public function getQueueOffset(){
- }
-}
diff --git a/rocketmq-client-php/autocomplete/SendStatus.php b/rocketmq-client-php/autocomplete/SendStatus.php
deleted file mode 100644
index ffa2812..0000000
--- a/rocketmq-client-php/autocomplete/SendStatus.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-class SendStatus{
- const SEND_OK = 0;
- const SEND_FLUSH_DISK_TIMEOUT = 1;
- const SEND_FLUSH_SLAVE_TIMEOUT = 2;
- const SEND_SLAVE_NOT_AVAILABLE = 3;
-}
diff --git a/rocketmq-client-php/autocomplete/SessionCredentials.php b/rocketmq-client-php/autocomplete/SessionCredentials.php
deleted file mode 100644
index f79a8d8..0000000
--- a/rocketmq-client-php/autocomplete/SessionCredentials.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * 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.
- */
-
-namespace RocketMQ;
-
-
-class SessionCredentials {
- public function __construct($accessKey, $secretKey, $authChannel){
- }
-
- public function __destruct(){
- }
-
- public function getAccessKey(){
- }
-
- public function setAccessKey($accessKey){
- }
-
- public function getSecretKey(){
- }
-
- public function setSecretKey(){
- }
-
- public function getSignature(){
- }
-
- public function setSignature($signature){
- }
-
- public function getSignatureMethod(){
- }
-
- public function setSignatureMethod($signatureMethod){
- }
-
- public function getAuthChannel(){
- }
-
- public function setAuthChannel($authChannel){
- }
-
- public function isValid(){
- }
-}
diff --git a/rocketmq-client-php/example/Message.php b/rocketmq-client-php/example/Message.php
deleted file mode 100644
index afca0a8..0000000
--- a/rocketmq-client-php/example/Message.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-
-function echo_msg($msg_ext){
- $msg = $msg_ext->getMessage();
- $arr = array(
- "msgId" => $msg_ext->getMsgId(),
- "topic" => $msg->getTopic(),
- "tags" => $msg->getTags(),
- "storeHostString" => $msg_ext->getStoreHostString(),
- "bornTimestamp" => $msg_ext->getBornTimestamp(),
- "queueId" => $msg_ext->getQueue(),
- "getBornTimestamp" => $msg_ext->getBornTimestamp(),
- "offsetMsgId" => $msg_ext->getOffsetMsgId(),
- "bodyCRC" => $msg_ext->getBodyCRC(),
- "queueOffset" => $msg_ext->getQueueOffset(),
- "commitLogOffset" => $msg_ext->getCommitLogOffset(),
- "storeSize" => $msg_ext->getStoreSize(),
- "reconsumeTimes" => $msg_ext->getReconsumeTimes(),
- "preparedTransactionOffset" => $msg_ext->getPreparedTransactionOffset(),
- "keys" => $msg->getKeys(),
- "delayTimeLevel" => $msg->getDelayTimeLevel(),
- "isWaitStoreMsgOK" => $msg->isWaitStoreMsgOK() ? "true" : "false",
- "flag" => $msg->getFlag(),
- "sysFlag" => $msg->getSysFlag(),
- "body" => substr($msg->getBody(),0,40),
-
- );
-
- foreach($arr as $key => $val){
- printf("|%-30s|%-40s|\n", $key, $val);
- }
- echo "-------------------------------------------------------------------------\n";
-}
-
diff --git a/rocketmq-client-php/example/Producer.php b/rocketmq-client-php/example/Producer.php
deleted file mode 100644
index 2fdfa89..0000000
--- a/rocketmq-client-php/example/Producer.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-namespace RocketMQ;
-$instanceName = "MessageQueue";
-
-$producer = new Producer($instanceName);
-$producer->setInstanceName($instanceName);
-$producer->setNamesrvAddr("127.0.0.1:9876");
-$producer->setTcpTransportPullThreadNum(40);
-$producer->getTcpTransportConnectTimeout(100);
-$producer->setTcpTransportTryLockTimeout(1);
-$producer->start();
-
-$queues = $producer->getTopicMessageQueueInfo("TopicTest");
-
- echo "-------------------------------------------------------------------------\n";
-foreach($queues as $queue){
- printf("|%-30s|%-40s|\n", "topic", $queue->getTopic());
- printf("|%-30s|%-40s|\n", "brokerName", $queue->getBrokerName());
- printf("|%-30s|%-40s|\n", "queueId", $queue->getQueueId());
- echo "-------------------------------------------------------------------------\n";
-}
-
-for ($i = 0; $i < 10000; $i ++){
- $message = new Message("TopicTest", "*", "hello world $i");
- $sendResult = $producer->send($message, $queues[3]);
- printf("|%-30s|%-40s|\n", "msgId", $sendResult->getMsgId());
- printf("|%-30s|%-40s|\n", "offsetMsgId", $sendResult->getOffsetMsgId());
- printf("|%-30s|%-40s|\n", "sendStatus", $sendResult->getSendStatus());
- printf("|%-30s|%-40s|\n", "queueOffset", $sendResult->getQueueOffset());
- printf("|%-30s|%-40s|\n", "body", $message->getBody());
- echo "-------------------------------------------------------------------------\n";
-}
diff --git a/rocketmq-client-php/example/PullConsumer.php b/rocketmq-client-php/example/PullConsumer.php
deleted file mode 100644
index fdde005..0000000
--- a/rocketmq-client-php/example/PullConsumer.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-
-namespace RocketMQ;
-
-include("Message.php");
-
-$consumer = new PullConsumer("pullTestGroup");
-$consumer->setGroup("pullTestGroup");
-$consumer->setInstanceName("testGroup");
-$consumer->setTopic("TopicTest");
-$consumer->setNamesrvAddr("127.0.0.1:9876");
-
-$consumer->setTcpTransportConnectTimeout(100);
-$consumer->setTcpTransportPullThreadNum(1);
-$consumer->setTcpTransportTryLockTimeout(100);
-$consumer->start();
-$queues = $consumer->getQueues();
-
-//foreach($queues as $queue){
-$queue = $queues[0];
-$newMsg = true;
-$offset = 0;
-$iter = 0;
-while($newMsg){
- $pullResult = $consumer->pull($queue, "*", $offset, 16);
-
- switch ($pullResult->getPullStatus()){
- case PullStatus::FOUND:
- echo "pullStatus: " . $pullResult->getPullStatus() . "\n";
- //echo "count: " . $pullResult->getCount() . "\n";
- echo "nextBeginOffset: " . $pullResult->getNextBeginOffset() . "\n";
- echo "minOffset: " . $pullResult->getMinOffset() . "\n";
- echo "maxOffset: " . $pullResult->getMaxOffset() . "\n";
- echo "pullStatus: " . $pullResult->getPullStatus() . "\n";
- echo "\n";
- foreach($pullResult as $key => $msg){
- echo_msg($msg);
- }
- break;
- case PullStatus::NO_MATCHED_MSG:
- case PullStatus::OFFSET_ILLEGAL:
- $newMsg = false;
- case PullStatus::BROKER_TIMEOUT:
- $newMsg = false;
- case PullStatus::NO_NEW_MSG:
- $newMsg = false;
- break;
- default:
- }
-
- $offset += count($pullResult);
-
- $iter ++;
- if ($iter > 16){
- break;
- }else{
- echo $iter . "\t";
- echo $offset . "\t";
- echo count($pullResult) . "\n";
- }
- // $queue->setMessageQueueOffset($position + $pullResult->getCount());
-}
-//}
diff --git a/rocketmq-client-php/example/PushConsumer.php b/rocketmq-client-php/example/PushConsumer.php
deleted file mode 100644
index 59c319e..0000000
--- a/rocketmq-client-php/example/PushConsumer.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-
-namespace RocketMQ;
-
-include("Message.php");
-
-$consumer = new PushConsumer("testGroup");
-$consumer->setInstanceName("testGroup");
-$consumer->setNamesrvAddr("127.0.0.1:9876");
-$consumer->setThreadCount(1);
-$consumer->setListenerType(MessageListenerType::LISTENER_ORDERLY);
-$consumer->setConsumeFromWhere(ConsumeFromWhere::CONSUME_FROM_FIRST_OFFSET);
-$consumer->setMessageModel(MessageModel::BROADCASTING);
-$result = array();
-$count = 0;
-// if thread > 1 & use echo method will core dump.
-$consumer->setCallback(function ($msg) use (&$count){
- echo_msg($msg);
- $count ++;
-});
-$consumer->subscribe("TopicTest", "*");
-$consumer->start();
-$consumer->shutdown();
-
diff --git a/rocketmq-client-php/src/common.h b/rocketmq-client-php/src/common.h
deleted file mode 100644
index a334224..0000000
--- a/rocketmq-client-php/src/common.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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_CLIENT_PHP_COMMON_H_
-#define ROCKETMQ_CLIENT_PHP_COMMON_H_
-#include <string>
-#include <iostream>
-#include <phpcpp.h>
-
-#define NAMESPACE_NAME "RocketMQ"
-
-#endif
diff --git a/rocketmq-client-php/src/consume_status.h b/rocketmq-client-php/src/consume_status.h
deleted file mode 100644
index 926e073..0000000
--- a/rocketmq-client-php/src/consume_status.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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_CLIENT_PHP_CONSUME_STATUS_H_
-#define ROCKETMQ_CLIENT_PHP_CONSUME_STATUS_H_
-
-#include "common.h"
-
-class ConsumeStatus: public Php::Base
-{
- //consume success, msg will be cleard from memory
- // CONSUME_SUCCESS
- //consume fail, but will be re-consume by call messageLisenter again
- // RECONSUME_LATER
-};
-
-void registerConsumeStatus(Php::Namespace &rocketMQNamespace){
- Php::Class<ConsumeStatus> consumeStatusClass("ConsumeStatus");
- consumeStatusClass.constant("CONSUME_SUCCESS", (int) rocketmq::CONSUME_SUCCESS);
- consumeStatusClass.constant("RECONSUME_LATER", (int) rocketmq::RECONSUME_LATER);
- rocketMQNamespace.add(consumeStatusClass);
-}
-
-#endif
diff --git a/rocketmq-client-php/src/consume_type.h b/rocketmq-client-php/src/consume_type.h
deleted file mode 100644
index 7667fdc..0000000
--- a/rocketmq-client-php/src/consume_type.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * 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_CLIENT_PHP_CONSUME_TYPE_H_
-#define ROCKETMQ_CLIENT_PHP_CONSUME_TYPE_H_
-
-#include "common.h"
-
-
-class ConsumeType : public Php::Base
-{
- // CONSUME_ACTIVELY,
- // CONSUME_PASSIVELY,
-};
-
-
-class ConsumeFromWhere : public Php::Base {
- /**
- *new consumer will consume from end offset of queue,
- * and then consume from last consumed offset of queue follow-up
- */
- //CONSUME_FROM_LAST_OFFSET,
-
- // @Deprecated
- //CONSUME_FROM_LAST_OFFSET_AND_FROM_MIN_WHEN_BOOT_FIRST,
- // @Deprecated
- //CONSUME_FROM_MIN_OFFSET,
- // @Deprecated
- //CONSUME_FROM_MAX_OFFSET,
- /**
- *new consumer will consume from first offset of queue,
- * and then consume from last consumed offset of queue follow-up
- */
- //CONSUME_FROM_FIRST_OFFSET,
- /**
- *new consumer will consume from the queue offset specified by timestamp,
- * and then consume from last consumed offset of queue follow-up
- */
- //CONSUME_FROM_TIMESTAMP,
-
-};
-
-class MessageModel : public Php::Base
-{
- // BROADCASTING,
- // CLUSTERING,
-};
-
-
-void registerConsumeType(Php::Namespace &rocketMQNamespace)
-{
- // class ConsumeType
- Php::Class<ConsumeType> consumeTypeClass("ConsumeType");
- consumeTypeClass.constant("CONSUME_ACTIVELY", rocketmq::CONSUME_ACTIVELY);
- consumeTypeClass.constant("CONSUME_PASSIVELY", rocketmq::CONSUME_PASSIVELY);
- rocketMQNamespace.add(consumeTypeClass);
-
- // class ConsumeFromWhere
- Php::Class<ConsumeFromWhere> consumeFromWhereClass("ConsumeFromWhere");
- consumeFromWhereClass.constant("CONSUME_FROM_LAST_OFFSET", rocketmq::CONSUME_FROM_LAST_OFFSET);
- consumeFromWhereClass.constant("CONSUME_FROM_LAST_OFFSET_AND_FROM_MIN_WHEN_BOOT_FIRST", rocketmq::CONSUME_FROM_LAST_OFFSET_AND_FROM_MIN_WHEN_BOOT_FIRST);
- consumeFromWhereClass.constant("CONSUME_FROM_MIN_OFFSET", rocketmq::CONSUME_FROM_MIN_OFFSET);
- consumeFromWhereClass.constant("CONSUME_FROM_MAX_OFFSET", rocketmq::CONSUME_FROM_MAX_OFFSET);
- consumeFromWhereClass.constant("CONSUME_FROM_FIRST_OFFSET", rocketmq::CONSUME_FROM_FIRST_OFFSET);
- consumeFromWhereClass.constant("CONSUME_FROM_TIMESTAMP", rocketmq::CONSUME_FROM_TIMESTAMP);
- rocketMQNamespace.add(consumeFromWhereClass);
-
- // class MessageModel
- Php::Class<MessageModel> messageModelClass("MessageModel");
- messageModelClass.constant("BROADCASTING", rocketmq::BROADCASTING);
- messageModelClass.constant("CLUSTERING", rocketmq::CLUSTERING);
- rocketMQNamespace.add(messageModelClass);
-}
-
-#endif
-
diff --git a/rocketmq-client-php/src/message.cc b/rocketmq-client-php/src/message.cc
deleted file mode 100644
index 08923fb..0000000
--- a/rocketmq-client-php/src/message.cc
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * 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"
-
-Message::Message(rocketmq::MQMessage &message){
- this->message = message;
-}
-
-void Message::__construct(Php::Parameters ¶ms){
- std::string topic = params[0];
- std::string tags = params[1];
- if (params.size() == 2){
- this->message = rocketmq::MQMessage(topic, tags);
- }else if (params.size() == 3){
- std::string body = params[2];
- this->message = rocketmq::MQMessage(topic, tags, body);
- }else if (params.size() == 4){
- std::string body = params[2];
- std::string keys = params[3];
- this->message = rocketmq::MQMessage(topic, tags, keys, body);
- }/*else if (params.size() == 6){
- std::string keys = params[2];
- std::string body = params[4];
- this->message = Message(topic, tags, keys, (int)params[3], body, params[5]);
- }*/
-}
-
-
-rocketmq::MQMessage& Message::getMQMessage(){
- return this->message;
-}
-
-//void setProperty(const std::string& name, const std::string& value) ;
-void Message::setProperty(Php::Parameters ¶ms){
- std::string name = params[0];
- std::string value = params[1];
-
- this->message.setProperty(name, value);
-}
-
-// const std::string &getTopic() const;
-Php::Value Message::getTopic(){
- return this->message.getTopic();
-}
-
-// void setTopic(const std::string& topic);
-void Message::setTopic(Php::Parameters ¶ms){
- std::string topic = params[0];
- this->message.setTopic(topic);
-}
-
-
-//const std::string &getTags() const;
-Php::Value Message::getTags(){
- return this->message.getTags();
-}
-
-void Message::setTags(Php::Parameters ¶ms){
- std::string tags = params[0];
- return this->message.setTags(tags);
-}
-
-//const std::string &getKeys() const;
-Php::Value Message::getKeys(){
- return this->message.getKeys();
-}
-
-// void setKeys(const std::string& keys);
-void Message::setKeys(Php::Parameters ¶ms){
- std::string keys = params[0];
- this->message.setKeys(keys);
-}
-
-Php::Value Message::getDelayTimeLevel(){
- return this->message.getDelayTimeLevel();
-}
-
-void Message::setDelayTimeLevel(Php::Parameters ¶ms){
- this->message.setDelayTimeLevel(params[0]);
-}
-
-Php::Value Message::isWaitStoreMsgOK(){
- return this->message.isWaitStoreMsgOK();
-}
-
-// void setWaitStoreMsgOK(bool waitStoreMsgOK);
-void Message::setWaitStoreMsgOK(Php::Parameters ¶ms){
- this->message.setWaitStoreMsgOK(params[0]);
-}
-
-//int getFlag() const;
-Php::Value Message::getFlag(){
- return this->message.getFlag();
-}
-
-//void setFlag(int flag);
-void Message::setFlag(Php::Parameters ¶ms){
- this->message.setFlag(params[0]);
-}
-
-//int getSysFlag() const;
-Php::Value Message::getSysFlag(){
- return this->message.getSysFlag();
-}
-
-//void setSysFlag(int sysFlag);
-void Message::setSysFlag(Php::Parameters ¶ms){
- this->message.setSysFlag(params[0]);
-}
-
-//const std::string &getBody() const;
-Php::Value Message::getBody(){
- return this->message.getBody();
-}
-
-//void setBody(const char* body, int len);
-//void setBody(const std::string& body);
-void Message::setBody(Php::Parameters ¶ms){
- std::string body = params[0];
- this->message.setBody(body);
-}
-
-
-// std::map<std::string, std::string> getProperties() const;
-Php::Value Message::getProperties(){
- Php::Array result;
- std::map<std::string, std::string>::iterator iter = this->message.getProperties().begin();
-
- for (; iter != this->message.getProperties().end(); iter ++){
- result[iter->first] = result[iter->second];
- }
-
- return result;
-}
-
-//void setProperties(std::map<std::string, std::string>& properties);
-void Message::setProperties(Php::Parameters ¶ms){
- std::map<std::string, std::string> properties = params[0];
- this->message.setProperties(properties);
-}
-
-// const std::string toString() const
-Php::Value Message::toString(){
- return this->message.toString();
-}
-
-//const std::string & getProperty(const std::string& name) const;
-Php::Value Message::getProperty(Php::Parameters ¶ms){
- std::string name = params[0];
- return this->message.getProperty(name);
-}
-
-
-void registerMessage(Php::Namespace &rocketMQNamespace){
- Php::Class<Message> messageClass("Message");
-
- messageClass.method<&Message::__construct>("__construct", {
- Php::ByVal("topic", Php::Type::String),
- Php::ByVal("tags", Php::Type::String),
- Php::ByVal("body", Php::Type::String, false),
- Php::ByVal("keys", Php::Type::String, false),
- });
-
- messageClass.method<&Message::setProperty>("setProperty", {
- Php::ByVal("name", Php::Type::String),
- Php::ByVal("value", Php::Type::String),
- });
- messageClass.method<&Message::getProperty>("getProperty", { Php::ByVal("name", Php::Type::String), });
-
- messageClass.method<&Message::getTopic>("getTopic");
- messageClass.method<&Message::setTopic>("setTopic", { Php::ByVal("topic", Php::Type::String), });
-
- messageClass.method<&Message::getTags>("getTags");
- messageClass.method<&Message::setTags>("setTags", { Php::ByVal("tags", Php::Type::String), });
-
- messageClass.method<&Message::getKeys>("getKeys");
- messageClass.method<&Message::setKeys>("setKeys", { Php::ByVal("keys", Php::Type::String), });
-
- messageClass.method<&Message::getDelayTimeLevel>("getDelayTimeLevel");
- messageClass.method<&Message::setDelayTimeLevel>("setDelayTimeLevel", { Php::ByVal("delayTimeLevel", Php::Type::Numeric), });
-
- messageClass.method<&Message::isWaitStoreMsgOK>("isWaitStoreMsgOK");
- messageClass.method<&Message::setWaitStoreMsgOK>("setWaitStoreMsgOK", { Php::ByVal("waitStoreMsgOK", Php::Type::Bool), });
-
- messageClass.method<&Message::getFlag>("getFlag");
- messageClass.method<&Message::setFlag>("setFlag", { Php::ByVal("flag", Php::Type::Numeric), });
-
- messageClass.method<&Message::getSysFlag>("getSysFlag");
- messageClass.method<&Message::setSysFlag>("setSysFlag", { Php::ByVal("sysFlag", Php::Type::Numeric), });
-
- messageClass.method<&Message::getBody>("getBody");
- messageClass.method<&Message::setBody>("setBody", { Php::ByVal("body", Php::Type::String), });
-
- messageClass.method<&Message::getProperties>("getProperties");
- messageClass.method<&Message::setProperties>("setProperties", { Php::ByVal("properties", Php::Type::Array), });
-
- messageClass.method<&Message::toString>("toString");
-
-
- rocketMQNamespace.add(messageClass);
-}
diff --git a/rocketmq-client-php/src/message.h b/rocketmq-client-php/src/message.h
deleted file mode 100644
index 48307fd..0000000
--- a/rocketmq-client-php/src/message.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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_CLIENT_PHP_MESSAGE_H_
-#define ROCKETMQ_CLIENT_PHP_MESSAGE_H_
-#include "common.h"
-#include <phpcpp.h>
-#include <iostream>
-#include <rocketmq/MQMessage.h>
-
-#define MESSAGE_CLASS_NAME NAMESPACE_NAME"\\Message"
-
-class Message: public Php::Base {
- private:
- rocketmq::MQMessage message;
- public:
- Message(){}
- Message(rocketmq::MQMessage &message);
-
- // MQMessage constructor.
- virtual void __construct(Php::Parameters ¶ms);
-
- rocketmq::MQMessage& getMQMessage();
-
- //void setProperty(const std::string& name, const std::string& value) ;
- void setProperty(Php::Parameters ¶ms);
-
- //const std::string & getProperty(const std::string& name) const;
- Php::Value getProperty(Php::Parameters ¶ms);
-
- // const std::string &getTopic() const;
- Php::Value getTopic();
- // void setTopic(const std::string& topic);
- void setTopic(Php::Parameters ¶ms);
-
- //const std::string &getTags() const;
- Php::Value getTags();
- //void setTags(const std::string& tags);
- void setTags(Php::Parameters ¶ms);
-
- //const std::string &getKeys() const;
- Php::Value getKeys();
- // void setKeys(const std::string& keys);
- void setKeys(Php::Parameters ¶ms);
-
- // TODO
- //void setKeys(const std::vector<std::string>& keys);
-
- //int getDelayTimeLevel() const;
- Php::Value getDelayTimeLevel();
-
- //void setDelayTimeLevel(int level);
- void setDelayTimeLevel(Php::Parameters ¶ms);
-
- //bool isWaitStoreMsgOK();
- Php::Value isWaitStoreMsgOK();
-
- // void setWaitStoreMsgOK(bool waitStoreMsgOK);
- void setWaitStoreMsgOK(Php::Parameters ¶ms);
-
- //int getFlag() const;
- Php::Value getFlag();
-
- //void setFlag(int flag);
- void setFlag(Php::Parameters ¶ms);
-
- //int getSysFlag() const;
- Php::Value getSysFlag();
-
- //void setSysFlag(int sysFlag);
- void setSysFlag(Php::Parameters ¶ms);
-
- //const std::string &getBody() const;
- Php::Value getBody();
-
- //void setBody(const char* body, int len);
- //void setBody(const std::string& body);
- void setBody(Php::Parameters ¶ms);
-
- // std::map<std::string, std::string> getProperties() const;
- Php::Value getProperties();
-
- //void setProperties(std::map<std::string, std::string>& properties);
- void setProperties(Php::Parameters ¶ms);
-
- // const std::string toString() const
- Php::Value toString();
-};
-void registerMessage(Php::Namespace &rocketMQNamespace);
-
-#endif
-
diff --git a/rocketmq-client-php/src/message_ext.cc b/rocketmq-client-php/src/message_ext.cc
deleted file mode 100644
index 805fa3f..0000000
--- a/rocketmq-client-php/src/message_ext.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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_ext.h"
-
-void registerMessageExt(Php::Namespace &rocketMQNamespace){
- Php::Class<MessageExt> messageExtClass("MessageExt");
-
- messageExtClass.method<&MessageExt::parseTopicFilterType>("parseTopicFilterType", { Php::ByVal("filterType", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getStoreHostString>("getStoreHostString");
-
- messageExtClass.method<&MessageExt::getQueueId>("getQueue");
- messageExtClass.method<&MessageExt::setQueueId>("setQueueId", { Php::ByVal("queueId", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getBornTimestamp>("getBornTimestamp");
- messageExtClass.method<&MessageExt::setBornTimestamp>("setBornTimestamp", { Php::ByVal("bornTimestamp", Php::Type::Numeric), });
-
-
- messageExtClass.method<&MessageExt::getMsgId>("getMsgId");
- messageExtClass.method<&MessageExt::setMsgId>("setMsgId", { Php::ByVal("msgId", Php::Type::String), });
-
- messageExtClass.method<&MessageExt::getOffsetMsgId>("getOffsetMsgId");
- messageExtClass.method<&MessageExt::setOffsetMsgId>("setOffsetMsgId", { Php::ByVal("offsetMsgId", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getBodyCRC>("getBodyCRC");
- messageExtClass.method<&MessageExt::setBodyCRC>("setBodyCRC", { Php::ByVal("bodyCRC", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getQueueOffset>("getQueueOffset");
- messageExtClass.method<&MessageExt::setQueueOffset>("setQueueOffset", { Php::ByVal("queueOffset", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getCommitLogOffset>("getCommitLogOffset");
- messageExtClass.method<&MessageExt::setCommitLogOffset>("setCommitLogOffset", { Php::ByVal("physicOffset", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getStoreSize>("getStoreSize");
- messageExtClass.method<&MessageExt::setStoreSize>("setStoreSize", { Php::ByVal("storeSize", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::getReconsumeTimes>("getReconsumeTimes");
-
- messageExtClass.method<&MessageExt::getPreparedTransactionOffset>("getPreparedTransactionOffset");
- messageExtClass.method<&MessageExt::setPreparedTransactionOffset>("setPreparedTransactionOffset", { Php::ByVal("preparedTransactionOffset", Php::Type::Numeric), });
-
- messageExtClass.method<&MessageExt::toString>("toString");
- messageExtClass.method<&MessageExt::getMessage>("getMessage");
- rocketMQNamespace.add(messageExtClass);
-}
diff --git a/rocketmq-client-php/src/message_ext.h b/rocketmq-client-php/src/message_ext.h
deleted file mode 100644
index 6b00f48..0000000
--- a/rocketmq-client-php/src/message_ext.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * 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_CLIENT_PHP_MESSAGE_EXT_H_
-#define ROCKETMQ_CLIENT_PHP_MESSAGE_EXT_H_
-
-#include "common.h"
-#include "message.h"
-#include <phpcpp.h>
-#include <iostream>
-#include <rocketmq/MQMessageExt.h>
-
-#define MESSAGE_EXT_CLASS_NAME NAMESPACE_NAME"\\MessageExt"
-
-class MessageExt: public Php::Base {
- private:
- rocketmq::MQMessageExt messageExt;
-
- public:
- MessageExt(rocketmq::MQMessageExt message){
- this->messageExt = message;
- }
-
- // static int parseTopicFilterType(int sysFlag);
- Php::Value parseTopicFilterType(Php::Parameters ¶ms){
- return this->messageExt.parseTopicFilterType(params[0]);
- }
-
- // int getQueueId() const;
- Php::Value getQueueId(){
- return this->messageExt.getQueueId();
- }
-
- // void setQueueId(int queueId);
- void setQueueId(Php::Parameters ¶ms){
- this->messageExt.setQueueId(params[0]);
- }
-
- //int64 getBornTimestamp() const;
- Php::Value getBornTimestamp(){
- return (int64_t)this->messageExt.getBornTimestamp();
- }
-
- //void setBornTimestamp(int64 bornTimestamp);
- void setBornTimestamp(Php::Parameters ¶m){
- this->messageExt.setBornTimestamp((int64_t)param[0]);
- }
-
- // sockaddr getStoreHost() const;
- // std::string getStoreHostString() const;
- Php::Value getStoreHostString(){
- return this->messageExt.getStoreHostString();
- }
-
- //void setStoreHost(const sockaddr& storeHost);
- // TODO
- //void setStoreHost(Php::Parameters ¶ms){ }
-
- //const std::string& getMsgId() const;
- Php::Value getMsgId(){
- return this->messageExt.getMsgId();
- }
-
- //void setMsgId(const std::string& msgId);
- void setMsgId(Php::Parameters ¶ms){
- std::string msgId = params[0];
- return this->messageExt.setMsgId(msgId);
- }
-
- //const std::string& getOffsetMsgId() const;
- Php::Value getOffsetMsgId(){
- return this->messageExt.getOffsetMsgId();
- }
-
- //void setOffsetMsgId(const std::string& offsetMsgId);
- void setOffsetMsgId(Php::Parameters ¶ms){
- std::string offsetMsgId =params[0];
- this->messageExt.setOffsetMsgId(offsetMsgId);
- }
-
- //int getBodyCRC() const;
- Php::Value getBodyCRC(){
- return this->messageExt.getBodyCRC();
- }
-
- //void setBodyCRC(int bodyCRC);
- void setBodyCRC(Php::Parameters ¶ms){
- this->messageExt.setBodyCRC(params[0]);
- }
-
- //int64 getQueueOffset() const;
- Php::Value getQueueOffset(){
- return (int64_t)this->messageExt.getQueueOffset();
- }
-
- //void setQueueOffset(int64 queueOffset);
- void setQueueOffset(Php::Parameters ¶ms){
- this->messageExt.setQueueOffset((int64_t)params[0]);
- }
-
- //int64 getCommitLogOffset() const;
- Php::Value getCommitLogOffset(){
- return (int64_t)this->messageExt.getCommitLogOffset();
- }
-
- //void setCommitLogOffset(int64 physicOffset);
- void setCommitLogOffset(Php::Parameters ¶ms){
- this->messageExt.setCommitLogOffset((int64_t)params[0]);
- }
-
- //int getStoreSize() const;
- Php::Value getStoreSize(){
- return this->messageExt.getStoreSize();
- }
-
- //void setStoreSize(int storeSize);
- void setStoreSize(Php::Parameters ¶ms){
- this->messageExt.setStoreSize(params[0]);
- }
-
- //int getReconsumeTimes() const;
- Php::Value getReconsumeTimes(){
- return this->messageExt.getReconsumeTimes();
- }
-
- //void setReconsumeTimes(int reconsumeTimes);
- void setReconsumeTimes(Php::Parameters ¶ms){
- this->messageExt.setReconsumeTimes(params[0]);
- }
-
- //int64 getPreparedTransactionOffset() const;
- Php::Value getPreparedTransactionOffset(){
- return (int64_t)this->messageExt.getPreparedTransactionOffset();
- }
-
- //void setPreparedTransactionOffset(int64 preparedTransactionOffset);
- void setPreparedTransactionOffset(Php::Parameters ¶ms){
- this->messageExt.setPreparedTransactionOffset((int64_t)params[0]);
- }
-
- // std::string toString();
- Php::Value toString(){
- return this->messageExt.toString();
- }
-
- Php::Value getMessage(){
- rocketmq::MQMessage msg = (rocketmq::MQMessage)this->messageExt;
- Php::Value message(Php::Object(MESSAGE_CLASS_NAME, new Message(msg)));
- return message;
- }
-};
-
-void registerMessageExt(Php::Namespace &rocketMQNamespace);
-#endif
diff --git a/rocketmq-client-php/src/message_queue.cc b/rocketmq-client-php/src/message_queue.cc
deleted file mode 100644
index 6e88fad..0000000
--- a/rocketmq-client-php/src/message_queue.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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_queue.h"
-
-MessageQueue::MessageQueue(const rocketmq::MQMessageQueue& other){
- messageQueue = other;
-}
-
-void MessageQueue::__construct(Php::Parameters ¶ms){
- std::string topic = params[0];
- std::string brokerName = params[1];
- int queueId = params[2];
-
- this->messageQueue = rocketmq::MQMessageQueue(topic, brokerName, queueId);
-}
-
-Php::Value MessageQueue::getTopic(){
- return this->messageQueue.getTopic();
-}
-
-void MessageQueue::setTopic(Php::Parameters ¶m){
- std::string topic = param[0];
- this->messageQueue.setTopic(topic);
-}
-
-Php::Value MessageQueue::getBrokerName(){
- return this->messageQueue.getBrokerName();
-}
-
-void MessageQueue::setBrokerName(Php::Parameters ¶m){
- std::string brokerName = param[0];
- this->messageQueue.setBrokerName(brokerName);
-}
-
-Php::Value MessageQueue::getQueueId() {
- return this->messageQueue.getQueueId();
-}
-
-void MessageQueue::setQueueId(Php::Parameters ¶m){
- return this->messageQueue.setQueueId(param[0]);
-}
-
-void registerMessageQueue(Php::Namespace &rocketMQNamespace){
- Php::Class<MessageQueue> messageQueueClass("MessageQueue");
-
- messageQueueClass.method<&MessageQueue::getTopic>("getTopic");
- messageQueueClass.method<&MessageQueue::setTopic>("setTopic", { Php::ByVal("topic", Php::Type::String), });
-
- messageQueueClass.method<&MessageQueue::getBrokerName>("getBrokerName");
- messageQueueClass.method<&MessageQueue::setBrokerName>("setBrokerName", { Php::ByVal("brokerName", Php::Type::String), });
-
- messageQueueClass.method<&MessageQueue::getQueueId>("getQueueId");
- messageQueueClass.method<&MessageQueue::setQueueId>("setQueueId", { Php::ByVal("queueId", Php::Type::String), });
-
- messageQueueClass.method<&MessageQueue::__construct>("__construct", {
- Php::ByVal("topic", Php::Type::String),
- Php::ByVal("brokerName", Php::Type::String),
- Php::ByVal("queueId", Php::Type::Numeric),
- });
-
- rocketMQNamespace.add(messageQueueClass);
-}
diff --git a/rocketmq-client-php/src/message_queue.h b/rocketmq-client-php/src/message_queue.h
deleted file mode 100644
index f00cffe..0000000
--- a/rocketmq-client-php/src/message_queue.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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_CLIENT_PHP_MESSAGE_QUEUE_H_
-#define ROCKETMQ_CLIENT_PHP_MESSAGE_QUEUE_H_
-
-#include <rocketmq/DefaultMQPullConsumer.h>
-#include "common.h"
-#include "message.h"
-#include "pull_result.h"
-
-#define MESSAGE_QUEUE_CLASS_NAME NAMESPACE_NAME"\\MessageQueue"
-
-class MessageQueue : public Php::Base
-{
- private:
- rocketmq::MQMessageQueue messageQueue;
-
- virtual ~MessageQueue(){}
-
- public:
- MessageQueue(const rocketmq::MQMessageQueue& other);
- void __construct(Php::Parameters ¶ms);
-
- Php::Value getTopic();
- void setTopic(Php::Parameters ¶m);
-
- Php::Value getBrokerName();
- void setBrokerName(Php::Parameters ¶m);
-
- Php::Value getQueueId() ;
- void setQueueId(Php::Parameters ¶m);
-
- rocketmq::MQMessageQueue& getInstance(){
- return this->messageQueue;
- }
-};
-
-void registerMessageQueue(Php::Namespace &rocketMQNamespace);
-
-#endif
diff --git a/rocketmq-client-php/src/msg_listener.cc b/rocketmq-client-php/src/msg_listener.cc
deleted file mode 100644
index 6edc0f5..0000000
--- a/rocketmq-client-php/src/msg_listener.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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 "msg_listener.h"
-#include "message_ext.h"
-
-void registerMessageListenerType(Php::Namespace &rocketMQNamespace){
- Php::Class<MessageListenerType> messageListenerTypeClass("MessageListenerType");
- messageListenerTypeClass.constant("LISTENER_DEFAULTLY", (int) rocketmq::messageListenerDefaultly);
- messageListenerTypeClass.constant("LISTENER_ORDERLY", (int) rocketmq::messageListenerOrderly);
- messageListenerTypeClass.constant("LISTENERCONCURRENTLY", (int) rocketmq::messageListenerConcurrently);
-
- rocketMQNamespace.add(messageListenerTypeClass);
-}
-
-rocketmq::ConsumeStatus commonConsumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs, Php::Value callback){
- for (size_t i = 0; i < msgs.size(); ++i) {
- Php::Value msgExt(Php::Object(MESSAGE_EXT_CLASS_NAME, new MessageExt(msgs[i])));
- int ret = callback(msgExt);
- if (rocketmq::CONSUME_SUCCESS != ret){
- return rocketmq::RECONSUME_LATER;
- }
- }
- return rocketmq::CONSUME_SUCCESS;
-}
-
-rocketmq::ConsumeStatus MsgListenerConcurrently::consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs) {
- return commonConsumeMessage(msgs, this->callback);
-}
-
-rocketmq::ConsumeStatus MsgListenerOrderly::consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs) {
- return commonConsumeMessage(msgs, this->callback);
-}
-
-rocketmq::ConsumeStatus MsgListener::consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs) {
- return commonConsumeMessage(msgs, this->callback);
-}
-
diff --git a/rocketmq-client-php/src/msg_listener.h b/rocketmq-client-php/src/msg_listener.h
deleted file mode 100644
index 6671575..0000000
--- a/rocketmq-client-php/src/msg_listener.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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_CLIENT_PHP_MESSAGE_LISTENER_TYPE_H_
-#define ROCKETMQ_CLIENT_PHP_MESSAGE_LISTENER_TYPE_H_
-
-#include "rocketmq/MQMessageListener.h"
-#include "common.h"
-
-class MessageListenerType : public Php::Base{
- // messageListenerDefaultly = 0,
- // messageListenerOrderly = 1,
- // messageListenerConcurrently = 2
-};
-
-void registerMessageListenerType(Php::Namespace &rocketMQNamespace);
-
-class MsgListenerConcurrently : public rocketmq::MessageListenerConcurrently {
- private:
- Php::Value callback;
- public:
- void setCallback(Php::Value callback){
- this->callback = callback;
- }
- MsgListenerConcurrently() {}
- ~MsgListenerConcurrently() {}
-
- rocketmq::ConsumeStatus consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs);
-};
-
-class MsgListenerOrderly: public rocketmq::MessageListenerOrderly {
- private:
- Php::Value callback;
- public:
- void setCallback(Php::Value callback){
- this->callback = callback;
- }
- MsgListenerOrderly() {}
- ~MsgListenerOrderly() {}
-
- rocketmq::ConsumeStatus consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs);
-};
-
-class MsgListener : public rocketmq::MQMessageListener {
- private:
- Php::Value callback;
- public:
- void setCallback(Php::Value callback){
- this->callback = callback;
- }
- MsgListener() {}
- ~MsgListener() {}
-
- rocketmq::ConsumeStatus consumeMessage(const std::vector<rocketmq::MQMessageExt> &msgs);
-};
-
-#endif
diff --git a/rocketmq-client-php/src/producer.cc b/rocketmq-client-php/src/producer.cc
deleted file mode 100644
index 604ec6f..0000000
--- a/rocketmq-client-php/src/producer.cc
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- * 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 "producer.h"
-#include "message_queue.h"
-#include "session_credentials.h"
-#include "send_result.h"
-
-void Producer::__construct(Php::Parameters ¶m){
- std::string groupName = param[0];
- this->producer = new rocketmq::DefaultMQProducer(groupName);
-}
-
-void Producer::setInstanceName(Php::Parameters ¶m){
- std::string instanceName = param[0];
- this->producer->setInstanceName(instanceName);
-}
-
-Php::Value Producer::getInstanceName(){
- return this->producer->getInstanceName();
-}
-
-
-void Producer::setGroupName(Php::Parameters ¶m){
- std::string groupName = param[0];
- this->producer->setGroupName(groupName);
-}
-
-Php::Value Producer::getGroupName(){
- return this->producer->getGroupName();
-}
-
-void Producer::setNamesrvAddr(Php::Parameters ¶m){
- std::string nameserver = param[0];
- this->producer->setNamesrvAddr(nameserver);
-}
-
-void Producer::start(){
- this->producer->start();
-}
-
-// SendResult send(MQMessage& msg, const MQMessageQueue& mq);
-Php::Value Producer::send(Php::Parameters ¶ms){
- Php::Value pvMessage = params[0];
- Message *message = (Message *)pvMessage.implementation();
- if (params.size() == 1){
- rocketmq::SendResult sr = this->producer->send(message->getMQMessage());
- Php::Value pv(Php::Object(SEND_RESULT_CLASS_NAME, new SendResult(sr)));
- return pv;
- }
-
- Php::Value pvMessageQueue = params[1];
- MessageQueue* messageQueue = (MessageQueue*)pvMessageQueue.implementation();
- rocketmq::SendResult sr = this->producer->send(message->getMQMessage(), messageQueue->getInstance());
- Php::Value pv(Php::Object(SEND_RESULT_CLASS_NAME, new SendResult(sr)));
- return pv;
-}
-
-Php::Value Producer::getMQClientId(){
- return this->producer->getMQClientId();
-}
-
-Php::Value Producer::getNamesrvAddr(){
- return this->producer->getNamesrvAddr();
-}
-
-Php::Value Producer::getTopicMessageQueueInfo(Php::Parameters ¶ms){
- std::string topic = params[0];
- Php::Array result;
-
- std::vector<rocketmq::MQMessageQueue> mqs = this->producer->getTopicMessageQueueInfo(topic);
- std::vector<rocketmq::MQMessageQueue>::iterator iter = mqs.begin();
- int idx = 0;
-
- for (; iter != mqs.end(); ++iter) {
- rocketmq::MQMessageQueue mq = (*iter);
- result[idx++] = Php::Object(MESSAGE_QUEUE_CLASS_NAME , new MessageQueue(mq));
- }
-
- return result;
-}
-
-void Producer::setSessionCredentials(Php::Parameters ¶m){
- std::string accessKey = param[0];
- std::string secretKey = param[1];
- std::string authChannel = param[2];
-
- this->producer->setSessionCredentials(accessKey, secretKey, authChannel);
-}
-
-Php::Value Producer::getSessionCredentials(){
- rocketmq::SessionCredentials sc = this->producer->getSessionCredentials();
- SessionCredentials *sessionCredentials = new SessionCredentials(&sc);
- Php::Value pv(Php::Object(SESSION_CREDENTIALS_CLASS_NAME , sessionCredentials));
- return pv;
-}
-
-void Producer::setNamesrvDomain(Php::Parameters ¶m){
- std::string domain = param[0];
- this->producer->setNamesrvDomain(domain);
-}
-
-Php::Value Producer::getNamesrvDomain(){
- return this->producer->getNamesrvDomain();
-}
-
-// int getRetryTimes() const;
-Php::Value Producer::getRetryTimes(){
- return this->producer->getRetryTimes();
-}
-
-// void setRetryTimes(int times);
-void Producer::setRetryTimes(Php::Parameters ¶m){
- this->producer->setRetryTimes(param[0]);
-}
-
-
-//int getSendMsgTimeout() const;
-Php::Value Producer::getSendMsgTimeout(){
- return this->producer->getSendMsgTimeout();
-}
-
-//void setSendMsgTimeout(int sendMsgTimeout);
-void Producer::setSendMsgTimeout(Php::Parameters ¶m){
- this->producer->setSendMsgTimeout(param[0]);
-}
-
-//int getCompressMsgBodyOverHowmuch() const;
-Php::Value Producer::getCompressMsgBodyOverHowmuch(){
- return this->producer->getCompressMsgBodyOverHowmuch();
-}
-
-//void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch);
-void Producer::setCompressMsgBodyOverHowmuch(Php::Parameters ¶m){
- this->producer->setCompressMsgBodyOverHowmuch(param[0]);
-}
-
-//int getCompressLevel() const;
-Php::Value Producer::getCompressLevel(){
- return this->producer->getCompressLevel();
-}
-
-//void setCompressLevel(int compressLevel);
-void Producer::setCompressLevel(Php::Parameters ¶m){
- this->producer->setCompressLevel(param[0]);
-}
-
-//int getMaxMessageSize() const;
-Php::Value Producer::getMaxMessageSize(){
- return this->producer->getMaxMessageSize();
-}
-
-//void setMaxMessageSize(int maxMessageSize);
-void Producer::setMaxMessageSize(Php::Parameters ¶m){
- this->producer->setMaxMessageSize(param[0]);
-}
-
-// void setTcpTransportPullThreadNum(int num);
-void Producer::setTcpTransportPullThreadNum(Php::Parameters ¶m){
- this->producer->setTcpTransportPullThreadNum((int64_t)param[0]);
-}
-
-// const int getTcpTransportPullThreadNum() const;
-Php::Value Producer::getTcpTransportPullThreadNum(){
- return (int64_t)this->producer->getTcpTransportPullThreadNum();
-}
-
-// void setTcpTransportConnectTimeout(uint64_t timeout); // ms
-void Producer::setTcpTransportConnectTimeout(Php::Parameters ¶m){
- this->producer->setTcpTransportConnectTimeout((int64_t)param[0]);
-}
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value Producer::getTcpTransportConnectTimeout(){
- return (int64_t)this->producer->getTcpTransportConnectTimeout();
-}
-
-// void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
-void Producer::setTcpTransportTryLockTimeout(Php::Parameters ¶m){
- this->producer->setTcpTransportTryLockTimeout((int64_t)param[0]);
-}
-
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value Producer::getTcpTransportTryLockTimeout(){
- return (int64_t)this->producer->getTcpTransportTryLockTimeout();
-}
-
-//void setUnitName(std::string unitName);
-void Producer::setUnitName(Php::Parameters ¶m){
- this->producer->setUnitName(param[0]);
-}
-//const std::string& getUnitName();
-Php::Value Producer::getUnitName(){
- return this->producer->getUnitName();
-}
-
-void Producer::setLogLevel(Php::Parameters ¶m){
- this->producer->setLogLevel(rocketmq::elogLevel((int)param[0]));
-}
-
-Php::Value Producer::getLogLevel(){
- return this->producer->getLogLevel();
-}
-
-void Producer::setLogFileSizeAndNum(Php::Parameters ¶m){
- this->producer->setLogFileSizeAndNum(param[0], param[1]);
-}
-
-void registerProducer(Php::Namespace &rocketMQNamespace){
- Php::Class<Producer> producerClass("Producer");
-
- producerClass.method<&Producer::getMQClientId>("getMQClientId");
-
- producerClass.method<&Producer::__construct>("__construct", { Php::ByVal("groupName", Php::Type::String), });
- producerClass.method<&Producer::__destruct>("__desatruct");
-
- producerClass.method<&Producer::getInstanceName>("getInstanceName");
- producerClass.method<&Producer::setInstanceName>("setInstanceName", { Php::ByVal("groupName", Php::Type::String), });
-
- producerClass.method<&Producer::getNamesrvAddr>("getNamesrvAddr");
- producerClass.method<&Producer::setNamesrvAddr>("setNamesrvAddr", { Php::ByVal("nameserver", Php::Type::String), });
-
- producerClass.method<&Producer::setNamesrvDomain>("setNamesrvDomain", { Php::ByVal("domain", Php::Type::String), });
- producerClass.method<&Producer::getNamesrvDomain>("getNamesrvDomain");
-
- producerClass.method<&Producer::getGroupName>("getGroupName");
- producerClass.method<&Producer::setGroupName>("setGroupName", { Php::ByVal("groupName", Php::Type::String), });
-
- producerClass.method<&Producer::start>("start");
- producerClass.method<&Producer::send>("send", { Php::ByVal("message", MESSAGE_CLASS_NAME), });
-
- producerClass.method<&Producer::getSessionCredentials>("getSessionCredentials");
- producerClass.method<&Producer::setSessionCredentials>("setSessionCredentials", {
- Php::ByVal("accessKey", Php::Type::String),
- Php::ByVal("secretKey", Php::Type::String),
- Php::ByVal("authChannel", Php::Type::String),
- });
-
- producerClass.method<&Producer::getTopicMessageQueueInfo>("getTopicMessageQueueInfo", { Php::ByVal("topic", Php::Type::String), });
-
-
- producerClass.method<&Producer::setRetryTimes>("setRetryTimes", { Php::ByVal("retryTimes", Php::Type::Numeric), });
- producerClass.method<&Producer::getRetryTimes>("getRetryTimes");
-
- producerClass.method<&Producer::getSendMsgTimeout>("getSendMsgTimeout");
- producerClass.method<&Producer::setSendMsgTimeout>("setSendMsgTimeout", {Php::ByVal("sendMsgTimeout", Php::Type::Numeric),});
-
- producerClass.method<&Producer::getCompressMsgBodyOverHowmuch>("getCompressMsgBodyOverHowmuch");
- producerClass.method<&Producer::setCompressMsgBodyOverHowmuch>("setCompressMsgBodyOverHowmuch", {Php::ByVal("compressMsgBodyOverHowmuch", Php::Type::Numeric),});
-
- producerClass.method<&Producer::getCompressLevel>("getCompressLevel");
- producerClass.method<&Producer::setCompressLevel>("setCompressLevel", {Php::ByVal("compressLevel", Php::Type::Numeric),});
-
- producerClass.method<&Producer::getMaxMessageSize>("getMaxMessageSize");
- producerClass.method<&Producer::setMaxMessageSize>("setMaxMessageSize", {Php::ByVal("maxMessageSize", Php::Type::Numeric),});
-
- producerClass.method<&Producer::getTcpTransportTryLockTimeout>("getTcpTransportTryLockTimeout");
- producerClass.method<&Producer::setTcpTransportTryLockTimeout>("setTcpTransportTryLockTimeout",{ Php::ByVal("timeout", Php::Type::Numeric), });
-
- producerClass.method<&Producer::getTcpTransportConnectTimeout>("getTcpTransportConnectTimeout");
- producerClass.method<&Producer::setTcpTransportConnectTimeout>("setTcpTransportConnectTimeout", {Php::ByVal("timeout", Php::Type::Numeric), });
-
- producerClass.method<&Producer::getTcpTransportPullThreadNum>("getTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
- producerClass.method<&Producer::setTcpTransportPullThreadNum>("setTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
-
- producerClass.method<&Producer::getUnitName>("getUnitName");
- producerClass.method<&Producer::setUnitName>("setUnitName", {Php::ByVal("unitName", Php::Type::String),});
-
- producerClass.method<&Producer::setLogLevel>("setLogLevel", {Php::ByVal("inputLevel", Php::Type::Numeric),});
- producerClass.method<&Producer::getLogLevel>("getLogLevel");
- producerClass.method<&Producer::setLogFileSizeAndNum>("setLogFileSizeAndNum", {Php::ByVal("fileNum", Php::Type::Numeric),Php::ByVal("perFileSize", Php::Type::Numeric),});
-
- rocketMQNamespace.add(producerClass);
-}
-
-
diff --git a/rocketmq-client-php/src/producer.h b/rocketmq-client-php/src/producer.h
deleted file mode 100644
index c54fb9f..0000000
--- a/rocketmq-client-php/src/producer.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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_CLIENT_PHP_PRODUCER_H_
-#define ROCKETMQ_CLIENT_PHP_PRODUCER_H_
-#include "common.h"
-#include <rocketmq/DefaultMQProducer.h>
-
-class Producer : public Php::Base
-{
- private:
- rocketmq::DefaultMQProducer *producer;
-
- public:
- Producer() { }
-
- virtual ~Producer() { }
-
- void __construct(Php::Parameters ¶m);
-
- void setInstanceName(Php::Parameters ¶m);
- Php::Value getInstanceName();
-
- void setNamesrvAddr(Php::Parameters ¶m);
- Php::Value getNamesrvAddr();
-
- Php::Value getNamesrvDomain();
- void setNamesrvDomain(Php::Parameters ¶m);
-
- Php::Value getTopicMessageQueueInfo(Php::Parameters ¶m);
-
- Php::Value getMQClientId();
-
- void setGroupName(Php::Parameters ¶m);
- Php::Value getGroupName();
-
- void start();
-
- Php::Value send(Php::Parameters ¶ms);
-
- void setSessionCredentials(Php::Parameters ¶m);
- Php::Value getSessionCredentials();
-
- Php::Value getRetryTimes();
- void setRetryTimes(Php::Parameters ¶m);
-
- //int getSendMsgTimeout() const;
- Php::Value getSendMsgTimeout();
-
- //void setSendMsgTimeout(int sendMsgTimeout);
- void setSendMsgTimeout(Php::Parameters ¶m);
-
- //int getCompressMsgBodyOverHowmuch() const;
- Php::Value getCompressMsgBodyOverHowmuch();
- //void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch);
- void setCompressMsgBodyOverHowmuch(Php::Parameters ¶m);
-
- //int getCompressLevel() const;
- Php::Value getCompressLevel();
- //void setCompressLevel(int compressLevel);
- void setCompressLevel(Php::Parameters ¶m);
-
- //int getMaxMessageSize() const;
- Php::Value getMaxMessageSize();
- //void setMaxMessageSize(int maxMessageSize);
- void setMaxMessageSize(Php::Parameters ¶m);
-
- // void setTcpTransportPullThreadNum(int num);
- void setTcpTransportPullThreadNum(Php::Parameters ¶m);
-
- // const int getTcpTransportPullThreadNum() const;
- Php::Value getTcpTransportPullThreadNum();
-
- // void setTcpTransportConnectTimeout(uint64_t timeout); // ms
- void setTcpTransportConnectTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportConnectTimeout();
-
- // void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
- void setTcpTransportTryLockTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportTryLockTimeout();
-
- //void setUnitName(std::string unitName);
- void setUnitName(Php::Parameters ¶m);
- //const std::string& getUnitName();
- Php::Value getUnitName();
-
- //void setLogLevel(elogLevel inputLevel);
- void setLogLevel(Php::Parameters ¶m);
- //ELogLevel getLogLevel();
- Php::Value getLogLevel();
- //void setLogFileSizeAndNum(int fileNum, long perFileSize); // perFileSize is MB unit
- void setLogFileSizeAndNum(Php::Parameters ¶m);
-
- virtual void __destruct(){
- if (this->producer != nullptr){
- producer->shutdown();
- delete(this->producer);
- }
- }
-};
-
-void registerProducer(Php::Namespace &rocketMQNamespace);
-
-#endif
diff --git a/rocketmq-client-php/src/pull_consumer.cc b/rocketmq-client-php/src/pull_consumer.cc
deleted file mode 100644
index aba5d41..0000000
--- a/rocketmq-client-php/src/pull_consumer.cc
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * 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 "pull_consumer.h"
-#include "session_credentials.h"
-
-void PullConsumer::__construct(Php::Parameters ¶ms){
- std::string groupName = params[0];
- this->consumer = new rocketmq::DefaultMQPullConsumer(groupName);
-}
-
-void PullConsumer::setGroup(Php::Parameters ¶ms){
- std::string groupName = params[0];
- this->consumer->setGroupName(groupName);
-}
-
-void PullConsumer::start(){
- this->consumer->start();
-}
-
-Php::Value PullConsumer::getQueues(){
- Php::Array result;
- int idx = 0;
- this->consumer->fetchSubscribeMessageQueues(this->topicName, this->mqs);
- std::vector<rocketmq::MQMessageQueue>::iterator iter = mqs.begin();
- for (; iter != mqs.end(); ++iter) {
- rocketmq::MQMessageQueue mq = (*iter);
- result[idx++] = Php::Object(MESSAGE_QUEUE_CLASS_NAME , new MessageQueue(mq));
- }
- return result;
-}
-
-Php::Value PullConsumer::getNamesrvDomain(){
- return this->consumer->getNamesrvDomain();
-}
-
-void PullConsumer::setNamesrvDomain(Php::Parameters ¶m){
- std::string namesrv_domain = param[0];
- this->consumer->setNamesrvDomain(namesrv_domain);
-}
-
-Php::Value PullConsumer::getNamesrvAddr(){
- return this->consumer->getNamesrvAddr();
-}
-
-void PullConsumer::setNamesrvAddr(Php::Parameters ¶m){
- std::string namesrv_addr = param[0];
- this->consumer->setNamesrvAddr(namesrv_addr);
-}
-
-void PullConsumer::setInstanceName(Php::Parameters ¶m){
- std::string instanceName = param[0];
- this->consumer->setInstanceName(instanceName);
-}
-
-void PullConsumer::setTopic(Php::Parameters ¶m){
- std::string topic = param[0];
- this->topicName= topic;
-}
-
-// pull( MessageQueue mq, string subExpression, int offset, int maxNums)
-Php::Value PullConsumer::pull(Php::Parameters ¶m){
- Php::Value mq = param[0];
- std::string subExpression = param[1];
- int64_t offset = param[2];
- int64_t maxNums = param[3];
- MessageQueue* messageQueue = (MessageQueue*)mq.implementation();
- rocketmq::PullResult result = this->consumer->pull(messageQueue->getInstance(), subExpression, offset, maxNums);
- PullResult *pullResult = new PullResult(result);
- Php::Value pv(Php::Object(PULL_RESULT_CLASS_NAME, pullResult));
- return pv;
-}
-
-/*
- void PullConsumer::persistConsumerOffset(){
- this->consumer->persistConsumerOffset();
- }
-
- void PullConsumer::persistConsumerOffsetByResetOffset(){
- this->consumer->persistConsumerOffsetByResetOffset();
- }
- */
-
-Php::Value PullConsumer::pullBlockIfNotFound(Php::Parameters ¶m){
- Php::Value mq = param[0];
- std::string subExpression = param[1];
- int64_t offset = param[2];
- int64_t maxNums = param[3];
- MessageQueue* messageQueue = (MessageQueue*)mq.implementation();
- rocketmq::PullResult result = this->consumer->pullBlockIfNotFound(messageQueue->getInstance(), subExpression, offset, maxNums);
- PullResult *pullResult = new PullResult(result);
- Php::Value pv(Php::Object(PULL_RESULT_CLASS_NAME, pullResult));
- return pv;
-}
-
-void PullConsumer::setSessionCredentials(Php::Parameters ¶m){
- std::string accessKey = param[0];
- std::string secretKey = param[1];
- std::string authChannel = param[2];
-
- this->consumer->setSessionCredentials(accessKey, secretKey, authChannel);
-}
-
-Php::Value PullConsumer::getSessionCredentials(){
- rocketmq::SessionCredentials sc = this->consumer->getSessionCredentials();
- SessionCredentials *sessionCredentials = new SessionCredentials(&sc);
- Php::Value pv(Php::Object(SESSION_CREDENTIALS_CLASS_NAME , sessionCredentials));
- return pv;
-}
-
-
-void PullConsumer::updateConsumeOffset(Php::Parameters ¶ms){
- Php::Value mq = params[0];
- int64_t offset = params[1];
-
- MessageQueue* messageQueue = (MessageQueue*)mq.implementation();
- this->consumer->updateConsumeOffset(messageQueue->getInstance(), offset);
-}
-
-void PullConsumer::removeConsumeOffset(Php::Parameters ¶ms){
- Php::Value mq = params[0];
- MessageQueue* messageQueue = (MessageQueue*)mq.implementation();
- this->consumer->removeConsumeOffset(messageQueue->getInstance());
-}
-
-Php::Value PullConsumer::fetchConsumeOffset(Php::Parameters ¶ms){
- Php::Value mq = params[0];
- bool fromStore = params[1];
- MessageQueue* messageQueue = (MessageQueue*)mq.implementation();
- return (int64_t)this->consumer->fetchConsumeOffset(messageQueue->getInstance(), fromStore);
-}
-
-Php::Value PullConsumer::getMessageModel(){
- return this->consumer->getMessageModel();
-}
-void PullConsumer::setMessageModel(Php::Parameters ¶ms){
- this->consumer->setMessageModel(rocketmq::MessageModel((int)params[0]));
-}
-
-// void setTcpTransportPullThreadNum(int num);
-void PullConsumer::setTcpTransportPullThreadNum(Php::Parameters ¶m){
- this->consumer->setTcpTransportPullThreadNum((int64_t)param[0]);
-}
-
-// const int getTcpTransportPullThreadNum() const;
-Php::Value PullConsumer::getTcpTransportPullThreadNum(){
- return (int64_t)this->consumer->getTcpTransportPullThreadNum();
-}
-
-// void setTcpTransportConnectTimeout(uint64_t timeout); // ms
-void PullConsumer::setTcpTransportConnectTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportConnectTimeout((int64_t)param[0]);
-}
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value PullConsumer::getTcpTransportConnectTimeout(){
- return (int64_t)this->consumer->getTcpTransportConnectTimeout();
-}
-
-// void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
-void PullConsumer::setTcpTransportTryLockTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportTryLockTimeout((int64_t)param[0]);
-}
-
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value PullConsumer::getTcpTransportTryLockTimeout(){
- return (int64_t)this->consumer->getTcpTransportTryLockTimeout();
-}
-
-//void setUnitName(std::string unitName);
-void PullConsumer::setUnitName(Php::Parameters ¶m){
- this->consumer->setUnitName(param[0]);
-}
-//const std::string& getUnitName();
-Php::Value PullConsumer::getUnitName(){
- return this->consumer->getUnitName();
-}
-
-void PullConsumer::setLogLevel(Php::Parameters ¶m){
- this->consumer->setLogLevel(rocketmq::elogLevel((int)param[0]));
-}
-
-Php::Value PullConsumer::getLogLevel(){
- return this->consumer->getLogLevel();
-}
-
-void PullConsumer::setLogFileSizeAndNum(Php::Parameters ¶m){
- this->consumer->setLogFileSizeAndNum(param[0], param[1]);
-}
-
-
-
-void registerPullConsumer(Php::Namespace &rocketMQNamespace){
- Php::Class<PullConsumer> pullConsumer("PullConsumer");
- pullConsumer.method<&PullConsumer::__construct>("__construct", { Php::ByVal("groupName", Php::Type::String), });
- pullConsumer.method<&PullConsumer::setInstanceName>("setInstanceName", { Php::ByVal("instance", Php::Type::String), });
- pullConsumer.method<&PullConsumer::setTopic>("setTopic", { Php::ByVal("topic", Php::Type::String), });
- pullConsumer.method<&PullConsumer::start>("start");
- pullConsumer.method<&PullConsumer::getQueues>("getQueues");
-
- pullConsumer.method<&PullConsumer::setNamesrvAddr>("setNamesrvAddr", { Php::ByVal("namesrvAddr", Php::Type::String), });
- pullConsumer.method<&PullConsumer::getNamesrvAddr>("getNamesrvAddr");
-
- pullConsumer.method<&PullConsumer::setNamesrvDomain>("setNamesrvDomain", { Php::ByVal("nameserver", Php::Type::String), });
- pullConsumer.method<&PullConsumer::getNamesrvDomain>("getNamesrvDomain");
-
- pullConsumer.method<&PullConsumer::setGroup>("setGroup", { Php::ByVal("group", Php::Type::String), });
- pullConsumer.method<&PullConsumer::pull>("pull", {
- Php::ByVal("mq", MESSAGE_QUEUE_CLASS_NAME),
- Php::ByVal("subExpression", Php::Type::String),
- Php::ByVal("offset", Php::Type::Numeric),
- Php::ByVal("maxNums", Php::Type::Numeric),
- });
-
- pullConsumer.method<&PullConsumer::pullBlockIfNotFound>("pullBlockIfNotFound", {
- Php::ByVal("mq", MESSAGE_QUEUE_CLASS_NAME),
- Php::ByVal("subExpression", Php::Type::String),
- Php::ByVal("offset", Php::Type::Numeric),
- Php::ByVal("maxNums", Php::Type::Numeric),
- });
-
- pullConsumer.method<&PullConsumer::setSessionCredentials>("setSessionCredentials", {
- Php::ByVal("accessKey", Php::Type::String),
- Php::ByVal("secretKey", Php::Type::String),
- Php::ByVal("authChannel", Php::Type::String),
- });
- pullConsumer.method<&PullConsumer::getSessionCredentials>("getSessionCredentials");
- pullConsumer.method<&PullConsumer::updateConsumeOffset>("updateConsumeOffset", {
- Php::ByVal("mq", MESSAGE_QUEUE_CLASS_NAME),
- Php::ByVal("offset", Php::Type::Numeric),
- });
- pullConsumer.method<&PullConsumer::removeConsumeOffset>("removeConsumeOffset", { Php::ByVal("mq", MESSAGE_QUEUE_CLASS_NAME), });
- pullConsumer.method<&PullConsumer::fetchConsumeOffset>("fetchConsumeOffset", {
- Php::ByVal("mq", MESSAGE_QUEUE_CLASS_NAME),
- Php::ByVal("fromStore", Php::Type::Bool),
- });
- pullConsumer.method<&PullConsumer::getMessageModel>("getMessageModel");
- pullConsumer.method<&PullConsumer::setMessageModel>("setMessageModel", { Php::ByVal("messageModel", Php::Type::Numeric), });
-
- pullConsumer.method<&PullConsumer::getTcpTransportTryLockTimeout>("getTcpTransportTryLockTimeout");
- pullConsumer.method<&PullConsumer::setTcpTransportTryLockTimeout>("setTcpTransportTryLockTimeout",{ Php::ByVal("timeout", Php::Type::Numeric), });
-
- pullConsumer.method<&PullConsumer::getTcpTransportConnectTimeout>("getTcpTransportConnectTimeout");
- pullConsumer.method<&PullConsumer::setTcpTransportConnectTimeout>("setTcpTransportConnectTimeout", {Php::ByVal("timeout", Php::Type::Numeric), });
-
- pullConsumer.method<&PullConsumer::getTcpTransportPullThreadNum>("getTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
- pullConsumer.method<&PullConsumer::setTcpTransportPullThreadNum>("setTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
-
- pullConsumer.method<&PullConsumer::getUnitName>("getUnitName");
- pullConsumer.method<&PullConsumer::setUnitName>("setUnitName", {Php::ByVal("unitName", Php::Type::String),});
-
- pullConsumer.method<&PullConsumer::setLogLevel>("setLogLevel", {Php::ByVal("inputLevel", Php::Type::Numeric),});
- pullConsumer.method<&PullConsumer::getLogLevel>("getLogLevel");
- pullConsumer.method<&PullConsumer::setLogFileSizeAndNum>("setLogFileSizeAndNum", {Php::ByVal("fileNum", Php::Type::Numeric),Php::ByVal("perFileSize", Php::Type::Numeric),});
-
-
-
- rocketMQNamespace.add(pullConsumer);
-}
diff --git a/rocketmq-client-php/src/pull_consumer.h b/rocketmq-client-php/src/pull_consumer.h
deleted file mode 100644
index d0664f6..0000000
--- a/rocketmq-client-php/src/pull_consumer.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * 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_CLIENT_PHP_PULL_CONSUMER_H_
-#define ROCKETMQ_CLIENT_PHP_PULL_CONSUMER_H_
-
-#include "common.h"
-#include <rocketmq/DefaultMQPullConsumer.h>
-#include "message.h"
-#include "message_queue.h"
-
-
-class PullConsumer:public Php::Base
-{
- private:
- std::string topicName;
- rocketmq::DefaultMQPullConsumer *consumer;
- std::vector<rocketmq::MQMessageQueue> mqs;
- public:
- PullConsumer(){
- this->consumer = nullptr;
- }
- virtual ~PullConsumer(){
- if (nullptr != this->consumer){
- delete(this->consumer);
- }
- }
- virtual void __construct(Php::Parameters ¶ms);
-
- void start();
-
- Php::Value getQueues();
-
- Php::Value getNamesrvDomain();
- void setNamesrvDomain(Php::Parameters ¶m);
-
- Php::Value getNamesrvAddr();
- void setNamesrvAddr(Php::Parameters ¶m);
-
- void setInstanceName(Php::Parameters ¶m);
-
- void setTopic(Php::Parameters ¶m);
-
- void setGroup(Php::Parameters ¶m);
-
- Php::Value pull(Php::Parameters ¶m);
- Php::Value pullBlockIfNotFound(Php::Parameters ¶m);
-
- void setSessionCredentials(Php::Parameters ¶m);
- Php::Value getSessionCredentials();
-
- void updateConsumeOffset(Php::Parameters ¶ms);
- void removeConsumeOffset(Php::Parameters ¶ms);
-
- Php::Value fetchConsumeOffset(Php::Parameters ¶ms);
-
- Php::Value getMessageModel();
- void setMessageModel(Php::Parameters ¶ms);
-
- // void setTcpTransportPullThreadNum(int num);
- void setTcpTransportPullThreadNum(Php::Parameters ¶m);
-
- // const int getTcpTransportPullThreadNum() const;
- Php::Value getTcpTransportPullThreadNum();
-
- // void setTcpTransportConnectTimeout(uint64_t timeout); // ms
- void setTcpTransportConnectTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportConnectTimeout();
-
- // void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
- void setTcpTransportTryLockTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportTryLockTimeout();
-
- //void setUnitName(std::string unitName);
- void setUnitName(Php::Parameters ¶m);
- //const std::string& getUnitName();
- Php::Value getUnitName();
-
- //void setLogLevel(elogLevel inputLevel);
- void setLogLevel(Php::Parameters ¶m);
- //ELogLevel getLogLevel();
- Php::Value getLogLevel();
- //void setLogFileSizeAndNum(int fileNum, long perFileSize); // perFileSize is MB unit
- void setLogFileSizeAndNum(Php::Parameters ¶m);
-};
-
-void registerPullConsumer(Php::Namespace &rocketMQNamespace);
-
-#endif
diff --git a/rocketmq-client-php/src/pull_result.cc b/rocketmq-client-php/src/pull_result.cc
deleted file mode 100644
index e210cbd..0000000
--- a/rocketmq-client-php/src/pull_result.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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 "pull_result.h"
-#include "pull_result_iterator.h"
-
-Php::Value PullResult::getMessage(Php::Parameters ¶m){
- Php::Value idx_val = param[0];
- int idx = idx_val;
-
- if (idx < (int)this->result.msgFoundList.size()){
- Php::Value msg(Php::Object(MESSAGE_EXT_CLASS_NAME, new MessageExt(this->result.msgFoundList[idx])));
- return msg;
- }
- return nullptr;
-}
-
-PullResult::PullResult(rocketmq::PullResult result){
- this->result = result;
-}
-
-Php::Value PullResult::getPullStatus(){
- return this->result.pullStatus;
-}
-
-Php::Value PullResult::getNextBeginOffset(){
- return (int64_t)this->result.nextBeginOffset;
-}
-
-Php::Value PullResult::getMinOffset(){
- return (int64_t)this->result.minOffset;
-}
-
-Php::Value PullResult::getMaxOffset(){
- return (int64_t)this->result.maxOffset;
-}
-
-long PullResult::count() {
- return this->result.msgFoundList.size();
-}
-
-Php::Iterator* PullResult::getIterator(){
- return new PullResultIterator(this, this->result.msgFoundList);
-}
-
-void registerPullResult(Php::Namespace &rocketMQNamespace){
- Php::Class<PullResult> pullResultClass("PullResult");
-
- pullResultClass.method<&PullResult::getMessage>("getMessage", { Php::ByVal("index", Php::Type::Numeric), });
- pullResultClass.method<&PullResult::getPullStatus>("getPullStatus");
- pullResultClass.method<&PullResult::getNextBeginOffset>("getNextBeginOffset");
- pullResultClass.method<&PullResult::getMinOffset>("getMinOffset");
- pullResultClass.method<&PullResult::getMaxOffset>("getMaxOffset");
-
- rocketMQNamespace.add(pullResultClass);
-}
diff --git a/rocketmq-client-php/src/pull_result.h b/rocketmq-client-php/src/pull_result.h
deleted file mode 100644
index 1b71325..0000000
--- a/rocketmq-client-php/src/pull_result.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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_CLIENT_PHP_PULL_RESULT_H_
-#define ROCKETMQ_CLIENT_PHP_PULL_RESULT_H_
-
-#include <rocketmq/PullResult.h>
-#include <phpcpp.h>
-#include "message_ext.h"
-#define PULL_RESULT_CLASS_NAME NAMESPACE_NAME"\\PullResult"
-
-class PullResult: public Php::Base, public Php::Countable, public Php::Traversable
-{
- private:
- rocketmq::PullResult result;
- public :
- ~PullResult(){ }
- PullResult(rocketmq::PullResult result);
-
- Php::Value getMessage(Php::Parameters ¶m);
-
- Php::Value getNextBeginOffset();
-
- Php::Value getMinOffset();
-
- Php::Value getMaxOffset();
-
- Php::Value getPullStatus();
-
- virtual long count() override;
-
- virtual Php::Iterator *getIterator() override;
-};
-
-void registerPullResult(Php::Namespace &rocketMQNamespace);
-#endif
diff --git a/rocketmq-client-php/src/pull_result_iterator.h b/rocketmq-client-php/src/pull_result_iterator.h
deleted file mode 100644
index 1ea570f..0000000
--- a/rocketmq-client-php/src/pull_result_iterator.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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_CLIENT_PHP_PULL_RESULT_ITERATOR_H_
-#define ROCKETMQ_CLIENT_PHP_PULL_RESULT_ITERATOR_H_
-
-#include <phpcpp.h>
-#include "pull_result.h"
-
-class PullResultIterator : public Php::Iterator
-{
- private:
- std::vector<rocketmq::MQMessageExt> &_vec;
- std::vector<rocketmq::MQMessageExt>::const_iterator _iter;
- public :
- PullResultIterator(PullResult *obj, std::vector<rocketmq::MQMessageExt> &vec)
- : Php::Iterator(obj), _vec(vec), _iter(vec.begin()) { }
-
- virtual ~PullResultIterator(){}
-
- virtual bool valid(){
- return this->_iter != this->_vec.end();
- }
-
- Php::Value key(){
- return this->_iter - this->_vec.begin();
- }
-
- void rewind(){
- this-> _iter = this->_vec.begin();
- }
-
- void next(){
- this->_iter ++;
- }
-
- Php::Value current(){
- return Php::Object(MESSAGE_EXT_CLASS_NAME, new MessageExt(*_iter));
- }
-};
-
-#endif
diff --git a/rocketmq-client-php/src/pull_status.h b/rocketmq-client-php/src/pull_status.h
deleted file mode 100644
index 5333eba..0000000
--- a/rocketmq-client-php/src/pull_status.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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_CLIENT_PHP_PULL_STATUS_H_
-#define ROCKETMQ_CLIENT_PHP_PULL_STATUS_H_
-
-#include "common.h"
-
-class PullStatus : public Php::Base
-{
- // FOUND,
- // NO_NEW_MSG,
- // NO_MATCHED_MSG,
- // OFFSET_ILLEGAL,
- // BROKER_TIMEOUT // indicate pull request timeout or received NULL response
-};
-
-void registerPullStatus(Php::Namespace &rocketMQNamespace){
- // class PullStatus
- Php::Class<PullStatus> pullStatusClass("PullStatus");
- pullStatusClass.constant("FOUND", (int)rocketmq::FOUND);
- pullStatusClass.constant("NO_MATCHED_MSG", (int)rocketmq::NO_MATCHED_MSG);
- pullStatusClass.constant("OFFSET_ILLEGAL", (int)rocketmq::OFFSET_ILLEGAL);
- pullStatusClass.constant("BROKER_TIMEOUT", (int)rocketmq::BROKER_TIMEOUT);
- pullStatusClass.constant("NO_NEW_MSG", (int)rocketmq::NO_NEW_MSG);
-
- rocketMQNamespace.add(pullStatusClass);
-}
-#endif
diff --git a/rocketmq-client-php/src/push_consumer.cc b/rocketmq-client-php/src/push_consumer.cc
deleted file mode 100644
index 0a05ed0..0000000
--- a/rocketmq-client-php/src/push_consumer.cc
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * 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 "push_consumer.h"
-#include "msg_listener.h"
-#include "session_credentials.h"
-
-void PushConsumer::doRebalance(){
- this->consumer->doRebalance();
-}
-
-void PushConsumer::persistConsumerOffset(){
- this->consumer->persistConsumerOffset();
-}
-void PushConsumer::persistConsumerOffsetByResetOffset(){
- this->consumer->persistConsumerOffsetByResetOffset();
-}
-
-void PushConsumer::setNamesrvDomain(Php::Parameters ¶m){
- std::string nameserver = param[0];
- this->consumer->setNamesrvDomain(nameserver);
-}
-
-Php::Value PushConsumer::getNamesrvDomain(){
- return this->consumer->getNamesrvDomain();
-}
-
-void PushConsumer::setNamesrvAddr(Php::Parameters ¶m){
- std::string namesrvAddr = param[0];
- this->consumer->setNamesrvAddr(namesrvAddr);
-}
-
-Php::Value PushConsumer::getNamesrvAddr(){
- return this->consumer->getNamesrvAddr();
-}
-
-
-void PushConsumer::setInstanceName(Php::Parameters ¶m){
- std::string groupName= param[0];
- this->consumer->setInstanceName(this->groupName);
-}
-
-void PushConsumer::setTryLockTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportTryLockTimeout((int64_t)param[0]);
-}
-
-void PushConsumer::setConnectTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportConnectTimeout((int64_t)param[0]);
-}
-
-void PushConsumer::setThreadCount(Php::Parameters ¶m){
- this->consumer->setConsumeThreadCount((int64_t)param[0]);
-}
-
-Php::Value PushConsumer::getConsumeType(){
- return (int) this->consumer->getConsumeType();
-}
-
-Php::Value PushConsumer::getConsumeFromWhere(){
- return (int) this->consumer->getConsumeFromWhere();
-}
-
-void PushConsumer::setConsumeFromWhere(Php::Parameters ¶m){
- int consumeFromWhere = (int) param[0];
- this->consumer->setConsumeFromWhere(rocketmq::ConsumeFromWhere(consumeFromWhere));
-}
-
-void PushConsumer::setListenerType(Php::Parameters ¶m){
- this->msgListenerType = param[0];
-}
-
-void PushConsumer::subscribe(Php::Parameters ¶m){
- std::string topic = param[0];
- std::string tag = param[1];
- this->consumer->subscribe(topic, tag);
-}
-void PushConsumer::setCallback(Php::Parameters ¶m){
- if (!param[0].isCallable())
- throw Php::Exception("Not a callable type.");
- this->callback = param[0];
-}
-
-void PushConsumer::setMaxRequestTime(Php::Parameters ¶m){
- this->maxRequestTime = (int)param[0];
-}
-
-void PushConsumer::start(){
- MsgListenerOrderly* msgListenerOrderly;
- MsgListenerConcurrently* msgListenerConcurrently;
- MsgListener* msgListener;
- switch(this->msgListenerType){
- case rocketmq::messageListenerOrderly:
- msgListenerOrderly = new MsgListenerOrderly();
- msgListenerOrderly->setCallback(this->callback);
- this->consumer->registerMessageListener(msgListenerOrderly);
- break;
- case rocketmq::messageListenerConcurrently:
- msgListenerConcurrently = new MsgListenerConcurrently();
- msgListenerConcurrently->setCallback(this->callback);
- this->consumer->registerMessageListener(msgListenerConcurrently);
- break;
- default :
- msgListener = new MsgListener();
- msgListener->setCallback(this->callback);
- this->consumer->registerMessageListener(msgListener);
- break;
- }
-
- try {
- this->consumer->start();
- } catch (rocketmq::MQClientException &e) {
- std::cout << e << std::endl;
- }
- sleep(this->maxRequestTime);
-}
-void PushConsumer::shutdown(){
- this->consumer->shutdown();
-}
-
-void PushConsumer::__construct(Php::Parameters ¶ms){
- std::string groupName = params[0];
- this->consumer = new rocketmq::DefaultMQPushConsumer(groupName);
-}
-
-void PushConsumer::setSessionCredentials(Php::Parameters ¶m){
- std::string accessKey = param[0];
- std::string secretKey = param[1];
- std::string authChannel = param[2];
-
- this->consumer->setSessionCredentials(accessKey, secretKey, authChannel);
-}
-
-Php::Value PushConsumer::getSessionCredentials(){
- rocketmq::SessionCredentials sc = this->consumer->getSessionCredentials();
- SessionCredentials *sessionCredentials = new SessionCredentials(&sc);
- Php::Value pv(Php::Object(SESSION_CREDENTIALS_CLASS_NAME , sessionCredentials));
- return pv;
-}
-
-Php::Value PushConsumer::getMessageModel(){
- return this->consumer->getMessageModel();
-}
-void PushConsumer::setMessageModel(Php::Parameters ¶ms){
- this->consumer->setMessageModel(rocketmq::MessageModel((int)params[0]));
-}
-
-// void setTcpTransportPullThreadNum(int num);
-void PushConsumer::setTcpTransportPullThreadNum(Php::Parameters ¶m){
- this->consumer->setTcpTransportPullThreadNum((int64_t)param[0]);
-}
-
-// const int getTcpTransportPullThreadNum() const;
-Php::Value PushConsumer::getTcpTransportPullThreadNum(){
- return (int64_t)this->consumer->getTcpTransportPullThreadNum();
-}
-
-// void setTcpTransportConnectTimeout(uint64_t timeout); // ms
-void PushConsumer::setTcpTransportConnectTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportConnectTimeout((int64_t)param[0]);
-}
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value PushConsumer::getTcpTransportConnectTimeout(){
- return (int64_t)this->consumer->getTcpTransportConnectTimeout();
-}
-
-// void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
-void PushConsumer::setTcpTransportTryLockTimeout(Php::Parameters ¶m){
- this->consumer->setTcpTransportTryLockTimeout((int64_t)param[0]);
-}
-
-// const uint64_t getTcpTransportConnectTimeout() const;
-Php::Value PushConsumer::getTcpTransportTryLockTimeout(){
- return (int64_t)this->consumer->getTcpTransportTryLockTimeout();
-}
-
-//void setUnitName(std::string unitName);
-void PushConsumer::setUnitName(Php::Parameters ¶m){
- this->consumer->setUnitName(param[0]);
-}
-//const std::string& getUnitName();
-Php::Value PushConsumer::getUnitName(){
- return this->consumer->getUnitName();
-}
-
-void PushConsumer::setLogLevel(Php::Parameters ¶m){
- this->consumer->setLogLevel(rocketmq::elogLevel((int)param[0]));
-}
-
-Php::Value PushConsumer::getLogLevel(){
- return this->consumer->getLogLevel();
-}
-
-void PushConsumer::setLogFileSizeAndNum(Php::Parameters ¶m){
- this->consumer->setLogFileSizeAndNum(param[0], param[1]);
-}
-
-
-
-void registerPushConsumer(Php::Namespace &rocketMQNamespace){
- Php::Class<PushConsumer> pushConsumer("PushConsumer");
- pushConsumer.method<&PushConsumer::doRebalance>("doRebalance");
- pushConsumer.method<&PushConsumer::persistConsumerOffset>("persistConsumerOffset");
- pushConsumer.method<&PushConsumer::persistConsumerOffsetByResetOffset>("persistConsumerOffsetByResetOffset");
- pushConsumer.method<&PushConsumer::__construct>("__construct", { Php::ByVal("groupName", Php::Type::String), });
- pushConsumer.method<&PushConsumer::setNamesrvDomain>("setNamesrvDomain", { Php::ByVal("nameserver", Php::Type::String), });
- pushConsumer.method<&PushConsumer::setNamesrvAddr>("setNamesrvAddr", { Php::ByVal("namesrvAddr", Php::Type::String), });
- pushConsumer.method<&PushConsumer::setInstanceName>("setInstanceName", { Php::ByVal("groupName", Php::Type::String), });
- pushConsumer.method<&PushConsumer::setTryLockTimeout>("setTryLockTimeout", {Php::ByVal("tryLockTimeout", Php::Type::Numeric),});
- pushConsumer.method<&PushConsumer::setConnectTimeout>("setConnectTimeout", {Php::ByVal("connectTimeout", Php::Type::Numeric),});
- pushConsumer.method<&PushConsumer::setThreadCount>("setThreadCount", {Php::ByVal("threadCount", Php::Type::Numeric),});
- pushConsumer.method<&PushConsumer::setListenerType>("setListenerType", {Php::ByVal("listenerType", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::getConsumeType>("getConsumeType");
- pushConsumer.method<&PushConsumer::getConsumeFromWhere>("getConsumeFromWhere");
- pushConsumer.method<&PushConsumer::setConsumeFromWhere>("setConsumeFromWhere", { Php::ByVal("consumeFromWhere", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::subscribe>("subscribe", {
- Php::ByVal("topic", Php::Type::String),
- Php::ByVal("tag", Php::Type::String),
- });
- pushConsumer.method<&PushConsumer::start>("start");
- pushConsumer.method<&PushConsumer::shutdown>("shutdown");
- pushConsumer.method<&PushConsumer::setMaxRequestTime>("setMaxRequestTime", { Php::ByVal("maxRequestTime", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::setCallback>("setCallback", { Php::ByVal("callback", Php::Type::Callable), });
-
- pushConsumer.method<&PushConsumer::setSessionCredentials>("setSessionCredentials", {
- Php::ByVal("accessKey", Php::Type::String),
- Php::ByVal("secretKey", Php::Type::String),
- Php::ByVal("authChannel", Php::Type::String),
- });
- pushConsumer.method<&PushConsumer::getSessionCredentials>("getSessionCredentials");
- pushConsumer.method<&PushConsumer::getMessageModel>("getMessageModel");
- pushConsumer.method<&PushConsumer::setMessageModel>("setMessageModel", {
- Php::ByVal("messageModel", Php::Type::Numeric),
- });
-
- pushConsumer.method<&PushConsumer::getTcpTransportTryLockTimeout>("getTcpTransportTryLockTimeout");
- pushConsumer.method<&PushConsumer::setTcpTransportTryLockTimeout>("setTcpTransportTryLockTimeout",{ Php::ByVal("timeout", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::getTcpTransportConnectTimeout>("getTcpTransportConnectTimeout");
- pushConsumer.method<&PushConsumer::setTcpTransportConnectTimeout>("setTcpTransportConnectTimeout", {Php::ByVal("timeout", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::getTcpTransportPullThreadNum>("getTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::setTcpTransportPullThreadNum>("setTcpTransportPullThreadNum", {Php::ByVal("threadNum", Php::Type::Numeric), });
- pushConsumer.method<&PushConsumer::getUnitName>("getUnitName");
- pushConsumer.method<&PushConsumer::setUnitName>("setUnitName", {Php::ByVal("unitName", Php::Type::String),});
-
- pushConsumer.method<&PushConsumer::setLogLevel>("setLogLevel", {Php::ByVal("inputLevel", Php::Type::Numeric),});
- pushConsumer.method<&PushConsumer::getLogLevel>("getLogLevel");
- pushConsumer.method<&PushConsumer::setLogFileSizeAndNum>("setLogFileSizeAndNum", {Php::ByVal("fileNum", Php::Type::Numeric),Php::ByVal("perFileSize", Php::Type::Numeric),});
-
-
- rocketMQNamespace.add(pushConsumer);
-}
-
-
diff --git a/rocketmq-client-php/src/push_consumer.h b/rocketmq-client-php/src/push_consumer.h
deleted file mode 100644
index 1f670d1..0000000
--- a/rocketmq-client-php/src/push_consumer.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * 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_CLIENT_PHP_PUSH_CONSUMER_H_
-#define ROCKETMQ_CLIENT_PHP_PUSH_CONSUMER_H_
-
-#include "common.h"
-#include "message.h"
-#include <rocketmq/DefaultMQPushConsumer.h>
-
-
-class PushConsumer : public Php::Base{
- private:
- std::string groupName;
- std::string namesrv_domain;
- std::string topic;
- rocketmq::DefaultMQPushConsumer *consumer;
- Php::Value callback;
- int msgListenerType;
- int maxRequestTime = 3600;
-
- public:
- PushConsumer(){}
- virtual ~PushConsumer(){}
- virtual void __construct(Php::Parameters ¶ms);
-
- void doRebalance();
-
- void persistConsumerOffset();
-
- void persistConsumerOffsetByResetOffset();
-
- void setNamesrvDomain(Php::Parameters ¶m);
-
- Php::Value getNamesrvDomain();
-
- void setNamesrvAddr(Php::Parameters ¶m);
-
- Php::Value getNamesrvAddr();
-
- void setInstanceName(Php::Parameters ¶m);
-
- void setTryLockTimeout(Php::Parameters ¶m);
-
- void setConnectTimeout(Php::Parameters ¶m);
-
- void setListenerType(Php::Parameters ¶m);
-
- void setThreadCount(Php::Parameters ¶m);
-
- void subscribe(Php::Parameters ¶m);
-
- void setCallback(Php::Parameters ¶m);
-
- Php::Value getConsumeType();
-
- Php::Value getConsumeFromWhere();
-
- void setConsumeFromWhere(Php::Parameters ¶m);
-
- void setMaxRequestTime(Php::Parameters ¶m);
-
- void start();
-
- void shutdown();
-
- virtual void __destruct() { }
-
- void setSessionCredentials(Php::Parameters ¶m);
- Php::Value getSessionCredentials();
-
- Php::Value getMessageModel();
- void setMessageModel(Php::Parameters ¶ms);
-
- // void setTcpTransportPullThreadNum(int num);
- void setTcpTransportPullThreadNum(Php::Parameters ¶m);
-
- // const int getTcpTransportPullThreadNum() const;
- Php::Value getTcpTransportPullThreadNum();
-
- // void setTcpTransportConnectTimeout(uint64_t timeout); // ms
- void setTcpTransportConnectTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportConnectTimeout();
-
- // void setTcpTransportTryLockTimeout(uint64_t timeout); // ms
- void setTcpTransportTryLockTimeout(Php::Parameters ¶m);
- // const uint64_t getTcpTransportConnectTimeout() const;
- Php::Value getTcpTransportTryLockTimeout();
-
- //void setUnitName(std::string unitName);
- void setUnitName(Php::Parameters ¶m);
- //const std::string& getUnitName();
- Php::Value getUnitName();
-
- //void setLogLevel(elogLevel inputLevel);
- void setLogLevel(Php::Parameters ¶m);
- //ELogLevel getLogLevel();
- Php::Value getLogLevel();
- //void setLogFileSizeAndNum(int fileNum, long perFileSize); // perFileSize is MB unit
- void setLogFileSizeAndNum(Php::Parameters ¶m);
-
-
-};
-
-void registerPushConsumer(Php::Namespace &rocketMQNamespace);
-
-#endif
diff --git a/rocketmq-client-php/src/rocketmq.cc b/rocketmq-client-php/src/rocketmq.cc
deleted file mode 100644
index bdfd488..0000000
--- a/rocketmq-client-php/src/rocketmq.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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 "common.h"
-#include "producer.h"
-#include "push_consumer.h"
-#include "pull_consumer.h"
-#include "message.h"
-#include "message_ext.h"
-#include "pull_status.h"
-#include "pull_result.h"
-#include "message_queue.h"
-#include "consume_type.h"
-#include "consume_status.h"
-#include "msg_listener.h"
-#include "session_credentials.h"
-#include "send_status.h"
-#include "send_result.h"
-
-// symbols are exported according to the "C" language
-extern "C"
-{
- // export the "get_module" function that will be called by the Zend engine
- PHPCPP_EXPORT void *get_module()
- {
- // all class in RocketMQ namespace.
- Php::Namespace rocketMQNamespace(NAMESPACE_NAME);
-
- // class Producer
- registerProducer(rocketMQNamespace);
-
- // class PullStatus
- registerPullStatus(rocketMQNamespace);
-
- // class ConsumeType, ConsumeFromWhere, MessageModel
- registerConsumeType(rocketMQNamespace);
-
- // class PushConsumer
- registerPushConsumer(rocketMQNamespace);
-
- // class PullResult
- registerPullResult(rocketMQNamespace);
-
- // class PullConsumer
- registerPullConsumer(rocketMQNamespace);
-
- // class MessageQueue
- registerMessageQueue(rocketMQNamespace);
-
- // class Message
- registerMessage(rocketMQNamespace);
-
- // class MessageExt
- registerMessageExt(rocketMQNamespace);
-
- // class ConsumeStatus
- registerConsumeStatus(rocketMQNamespace);
-
- // class MessageListenerType
- registerMessageListenerType(rocketMQNamespace);
-
- // class SessionCredentials
- registerSessionCredentials(rocketMQNamespace);
-
- // class SendStatus
- registerSendStatus(rocketMQNamespace);
-
- // class SendResult
- registerSendResult(rocketMQNamespace);
-
- //registerClient(rocketMQNamespace);
- // create extension
- static Php::Extension extension("rocketmq", "1.0");
- extension.add(std::move(rocketMQNamespace));
-
- // return the module entry
- return extension.module();
- }
-}
-
diff --git a/rocketmq-client-php/src/send_result.cc b/rocketmq-client-php/src/send_result.cc
deleted file mode 100644
index 06341be..0000000
--- a/rocketmq-client-php/src/send_result.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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 "send_result.h"
-
-SendResult::SendResult(rocketmq::SendResult& sendResult){
- this->sendResult = sendResult;
-}
-Php::Value SendResult::getMsgId(){
- return this->sendResult.getMsgId();
-}
-Php::Value SendResult::getOffsetMsgId(){
- return this->sendResult.getOffsetMsgId();
-}
-Php::Value SendResult::getSendStatus(){
- return (int64_t)this->sendResult.getSendStatus();
-}
-
-Php::Value SendResult::getMessageQueue(){
- rocketmq::MQMessageQueue mq = this->sendResult.getMessageQueue();
- return Php::Object(MESSAGE_QUEUE_CLASS_NAME, new MessageQueue(mq));
-}
-
-Php::Value SendResult::getQueueOffset(){
- return (int64_t) this->sendResult.getQueueOffset();
-}
-
-void registerSendResult(Php::Namespace &rocketMQNamespace){
- Php::Class<SendResult> sendResultClass("SendResult");
-
- sendResultClass.method<&SendResult::getMsgId>("getMsgId");
- sendResultClass.method<&SendResult::getOffsetMsgId>("getOffsetMsgId");
- sendResultClass.method<&SendResult::getSendStatus>("getSendStatus");
- sendResultClass.method<&SendResult::getMessageQueue>("getMessageQueue");
- sendResultClass.method<&SendResult::getQueueOffset>("getQueueOffset");
-
- rocketMQNamespace.add(sendResultClass);
-}
-
diff --git a/rocketmq-client-php/src/send_result.h b/rocketmq-client-php/src/send_result.h
deleted file mode 100644
index a8bb388..0000000
--- a/rocketmq-client-php/src/send_result.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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_CLIENT_PHP_SEND_RESULT_H_
-#define ROCKETMQ_CLIENT_PHP_SEND_RESULT_H_
-
-#include "common.h"
-#include "message_queue.h"
-#include <rocketmq/SendResult.h>
-
-#define SEND_RESULT_CLASS_NAME NAMESPACE_NAME"\\SendResult"
-
-class SendResult: public Php::Base
-{
- private:
- rocketmq::SendResult sendResult;
-
- public:
- SendResult(rocketmq::SendResult& sendResult);
-
- Php::Value getMsgId();
-
- Php::Value getOffsetMsgId();
-
- Php::Value getSendStatus();
-
- Php::Value getMessageQueue();
-
- Php::Value getQueueOffset();
-};
-
-void registerSendResult(Php::Namespace &rocketMQNamespace);
-
-#endif
-
diff --git a/rocketmq-client-php/src/send_status.h b/rocketmq-client-php/src/send_status.h
deleted file mode 100644
index 3c5ad68..0000000
--- a/rocketmq-client-php/src/send_status.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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_CLIENT_PHP_SEND_STATUS_H_
-#define ROCKETMQ_CLIENT_PHP_SEND_STATUS_H_
-
-#include <rocketmq/SendResult.h>
-#include "common.h"
-
-class SendStatus : public Php::Base
-{
- //SEND_OK,
- //SEND_FLUSH_DISK_TIMEOUT,
- //SEND_FLUSH_SLAVE_TIMEOUT,
- //SEND_SLAVE_NOT_AVAILABLE
-};
-
-void registerSendStatus(Php::Namespace &rocketMQNamespace)
-{
- Php::Class<SendStatus> sendStatusClass("SendStatus");
- sendStatusClass.constant("SEND_OK", rocketmq::SEND_OK);
- sendStatusClass.constant("SEND_FLUSH_DISK_TIMEOUT", rocketmq::SEND_FLUSH_DISK_TIMEOUT);
- sendStatusClass.constant("SEND_FLUSH_SLAVE_TIMEOUT", rocketmq::SEND_FLUSH_SLAVE_TIMEOUT);
- sendStatusClass.constant("SEND_SLAVE_NOT_AVAILABLE", rocketmq::SEND_SLAVE_NOT_AVAILABLE);
- rocketMQNamespace.add(sendStatusClass);
-}
-
-#endif
diff --git a/rocketmq-client-php/src/session_credentials.cc b/rocketmq-client-php/src/session_credentials.cc
deleted file mode 100644
index 973b4bf..0000000
--- a/rocketmq-client-php/src/session_credentials.cc
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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 "session_credentials.h"
-
-void SessionCredentials::__construct(Php::Parameters ¶ms){
- std::string accessKey = params[0];
- std::string secretKey = params[1];
- std::string authChannel = params[2];
-
- if (sc != nullptr){
- this->sc = new rocketmq::SessionCredentials(accessKey, secretKey, authChannel);
- }else{
- this->sc->setAccessKey(accessKey);
- this->sc->setSecretKey(secretKey);
- this->sc->setAuthChannel(authChannel);
- }
-}
-void SessionCredentials::__destruct(){
- delete(this->sc);
-}
-
-Php::Value SessionCredentials::getAccessKey(){
- return this->sc->getAccessKey();
-}
-void SessionCredentials::setAccessKey(Php::Parameters ¶ms){
- std::string accessKey = params[0];
-
- return this->sc->setAccessKey(accessKey);
-}
-
-Php::Value SessionCredentials::getSecretKey(){
- return this->sc->getAccessKey();
-}
-void SessionCredentials::setSecretKey(Php::Parameters ¶ms){
- std::string secretKey = params[0];
- this->sc->setSecretKey(secretKey);
-}
-
-Php::Value SessionCredentials::getSignature(){
- return this->sc->getSignature();
-}
-void SessionCredentials::setSignature(Php::Parameters ¶ms){
- std::string signature = params[0];
- this->sc->setSignature(signature);
-}
-
-Php::Value SessionCredentials::getSignatureMethod(){
- return this->sc->getSignatureMethod();
-}
-void SessionCredentials::setSignatureMethod(Php::Parameters ¶ms){
- std::string signatureMethod = params[0];
- this->sc->setSignatureMethod(signatureMethod);
-}
-
-Php::Value SessionCredentials::getAuthChannel(){
- return this->sc->getAuthChannel();
-}
-void SessionCredentials::setAuthChannel(Php::Parameters ¶ms){
- std::string authChannel = params[0];
- this->sc->setAuthChannel(authChannel);
-}
-
-Php::Value SessionCredentials::isValid(){
- return this->sc->isValid();
-}
-
-void registerSessionCredentials(Php::Namespace &rocketMQNamespace){
- Php::Class<SessionCredentials> scClass("SessionCredentials");
-
- scClass.method<&SessionCredentials::__construct>("__construct", {
- Php::ByVal("accessKey", Php::Type::String, false),
- Php::ByVal("secretKey", Php::Type::String, false),
- Php::ByVal("authChannel", Php::Type::String, false),
- });
- scClass.method<&SessionCredentials::__destruct>("__destruct");
-
- scClass.method<&SessionCredentials::getAccessKey>("getAccessKey");
- scClass.method<&SessionCredentials::setAccessKey>("setAccessKey",{
- Php::ByVal("accessKey", Php::Type::String),
- });
-
- scClass.method<&SessionCredentials::getSecretKey>("getSecretKey");
- scClass.method<&SessionCredentials::setSecretKey>("setSecretKey", {
- Php::ByVal("secretKey", Php::Type::String),
- });
-
- scClass.method<&SessionCredentials::getSignature>("getSignature");
- scClass.method<&SessionCredentials::setSignature>("setSignature", {
- Php::ByVal("signature", Php::Type::String),
- });
-
- scClass.method<&SessionCredentials::getSignatureMethod>("getSignatureMethod");
- scClass.method<&SessionCredentials::setSignatureMethod>("setSignatureMethod",{
- Php::ByVal("signatureMethod", Php::Type::String),
- });
-
- scClass.method<&SessionCredentials::getAuthChannel>("getAuthChannel");
- scClass.method<&SessionCredentials::setAuthChannel>("setAuthChannel", {
- Php::ByVal("authChannel", Php::Type::String),
- });
-
- scClass.method<&SessionCredentials::isValid>("isValid");
-
- rocketMQNamespace.add(scClass);
-}
diff --git a/rocketmq-client-php/src/session_credentials.h b/rocketmq-client-php/src/session_credentials.h
deleted file mode 100644
index 8c9083b..0000000
--- a/rocketmq-client-php/src/session_credentials.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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_CLIENT_PHP_SESSION_CREDENTIALS_H_
-#define ROCKETMQ_CLIENT_PHP_SESSION_CREDENTIALS_H_
-#include "common.h"
-#include <rocketmq/SessionCredentials.h>
-
-#define SESSION_CREDENTIALS_CLASS_NAME NAMESPACE_NAME"\\SessionCredentials"
-
-class SessionCredentials : public Php::Base {
- rocketmq::SessionCredentials* sc;
-
- public:
-
- SessionCredentials(rocketmq::SessionCredentials* sc){
- this->sc = sc;
- }
-
- void __construct(Php::Parameters ¶ms);
- void __destruct();
-
- Php::Value getAccessKey();
- void setAccessKey(Php::Parameters ¶ms);
-
- Php::Value getSecretKey();
- void setSecretKey(Php::Parameters ¶ms);
-
- Php::Value getSignature();
- void setSignature(Php::Parameters ¶ms);
-
- Php::Value getSignatureMethod();
- void setSignatureMethod(Php::Parameters ¶ms);
-
- Php::Value getAuthChannel();
- void setAuthChannel(Php::Parameters ¶ms);
-
- Php::Value isValid();
-};
-
-void registerSessionCredentials(Php::Namespace &rocketMQNamespace);
-#endif
diff --git a/rocketmq-php/.gitignore b/rocketmq-php/.gitignore
deleted file mode 100644
index c61f94d..0000000
--- a/rocketmq-php/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-bin
-coverage.out
-.idea/
-*.iml
-*.swp
-*.log
-tags
-temp_parser_file
-y.output
-/vendor/
-.vscode/
diff --git a/rocketmq-php/LICENSE b/rocketmq-php/LICENSE
deleted file mode 100644
index b67d909..0000000
--- a/rocketmq-php/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {}
-
- Licensed 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.
diff --git a/rocketmq-php/NOTICE b/rocketmq-php/NOTICE
deleted file mode 100644
index 5384857..0000000
--- a/rocketmq-php/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache RocketMQ (incubating)
-Copyright 2016-2017 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
diff --git a/rocketmq-php/composer.json b/rocketmq-php/composer.json
deleted file mode 100644
index 65d6566..0000000
--- a/rocketmq-php/composer.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "rocketmq/rocketmq-php-sdk",
- "description": "RocketMQ PHP SDK written with pure php code.",
- "type": "library",
- "license": "Apache-2.0",
- "authors": [{
- "name": "huzhifeng",
- "email": "huzhifeng@douyu.tv"
- }],
- "require": {},
- "autoload": {
- "psr-4": {
- "RocketMQ\\": "src/"
- }
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/example/simple/AsyncProducer.php b/rocketmq-php/example/simple/AsyncProducer.php
deleted file mode 100644
index 1727835..0000000
--- a/rocketmq-php/example/simple/AsyncProducer.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * 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.
- */
-use RocketMQ\Client\Producer\DefaultMQProducer;
-use RocketMQ\Common\Message\Message;
-use RocketMQ\Remoting\Common\RemotingHelper;
-
-$producer = new DefaultMQProducer("Jodie_Daily_test");
-$producer->start();
-$producer->setRetryTimesWhenSendAsyncFailed(0);
-
-for ($i = 0; $i < 10000000; $i++) {
-
- try {
- $index = $i;
- $msg = new Message("Jodie_topic_1023",
- "TagA",
- "OrderID188",
- "Hello world" . getBytes(RemotingHelper::DEFAULT_CHARSET));
- $producer->send($msg, new class() extends SendCallback() {
- public
- function onSuccess($sendResult)
- {
- printf("%-10d OK %s %n", $index, $sendResult->getMsgId());
- }
-
- public
- function onException($e)
- {
- printf("%-10d Exception %s %n", $index, $e);
- $e->printStackTrace();
- }
- });
-} catch (\Exception $e) {
- echo $e->getTraceAsString();
- }
-
-}
-$producer->shutdown();
\ No newline at end of file
diff --git a/rocketmq-php/example/simple/Producer.php b/rocketmq-php/example/simple/Producer.php
deleted file mode 100644
index 931c50d..0000000
--- a/rocketmq-php/example/simple/Producer.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * 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.
- */
-use RocketMQ\Client\Producer\DefaultMQProducer;
-use RocketMQ\Common\Message\Message;
-
-$producer = new DefaultMQProducer("ProducerGroupName");
-$producer->start();
-
-for ($i = 0; $i < 10000000; $i++) {
- try {
- $msg = new Message("TopicTest",
- "TagA",
- "OrderID188",
- "Hello world");
- $sendResult = $producer->send($msg);
- echo $sendResult;
- } catch (\Exception $e) {
- echo $e->getMessage() . PHP_EOL . $e->getTraceAsString();
- }
-}
-$producer->shutdown();
\ No newline at end of file
diff --git a/rocketmq-php/readme.md b/rocketmq-php/readme.md
deleted file mode 100644
index a209fda..0000000
--- a/rocketmq-php/readme.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# RocketMQ PHP SDK
-
-This is PHP SDK for RocketMQ. Written with pure PHP language.
\ No newline at end of file
diff --git a/rocketmq-php/src/Client/Common/ClientErrorCode.php b/rocketmq-php/src/Client/Common/ClientErrorCode.php
deleted file mode 100644
index f06cf52..0000000
--- a/rocketmq-php/src/Client/Common/ClientErrorCode.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Common;
-
-class ClientErrorCode
-{
- const CONNECT_BROKER_EXCEPTION = 10001;
- const ACCESSS_BROKER_TIMEOUT = 10002;
- const BROKER_NOT_EXIST_EXCEPTION = 10003;
- const NO_NAME_SERVER_EXCEPTION = 10004;
- const NOT_FOUND_TOPIC_EXCEPTION = 10005;
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Client/Exception/MQBrokerException.php b/rocketmq-php/src/Client/Exception/MQBrokerException.php
deleted file mode 100644
index 7d6fa95..0000000
--- a/rocketmq-php/src/Client/Exception/MQBrokerException.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Exception;
-
-class MQBrokerException extends \Exception
-{
-
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Client/Exception/MQClientException.php b/rocketmq-php/src/Client/Exception/MQClientException.php
deleted file mode 100644
index 0857e4c..0000000
--- a/rocketmq-php/src/Client/Exception/MQClientException.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Exception;
-
-class MQClientException extends \Exception
-{
-
- public function setResponseCode($code)
- {
- $this->responseCode = $code;
- return $this;
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Client/Latency/MQFaultStrategy.php b/rocketmq-php/src/Client/Latency/MQFaultStrategy.php
deleted file mode 100644
index 3f05b7f..0000000
--- a/rocketmq-php/src/Client/Latency/MQFaultStrategy.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Latency;
-
-class MQFaultStrategy
-{
- public $log;
- public $latencyFaultTolerance;
- public $sendLatencyFaultEnable = false;
- public $latencyMax = [50, 100, 550, 1000, 2000, 3000, 15000];
- public $notAvailableDuration = [0, 0, 30000, 60000, 120000, 180000, 600000];
- public function __construct()
- {
- $this->log = ClientLogger.getLog();
- $this->latencyFaultTolerance = new LatencyFaultToleranceImpl();
- }
- public function getNotAvailableDuration()
- {
- return $this->notAvailableDuration;
- }
- public function setNotAvailableDuration($notAvailableDuration)
- {
- $this->notAvailableDuration = $notAvailableDuration;
- }
-
- public function getLatencyMax()
- {
- return $this->latencyMax;
- }
-
- public function setLatencyMax($latencyMax)
- {
- $this->latencyMax = $latencyMax;
- }
-
- public function isSendLatencyFaultEnable()
- {
- return $this->sendLatencyFaultEnable;
- }
- public function setSendLatencyFaultEnable($sendLatencyFaultEnable)
- {
- $this->sendLatencyFaultEnable = $sendLatencyFaultEnable;
- }
- public function selectOneMessageQueue($tpInfo, $lastBrokerName)
- {
- if ($this->sendLatencyFaultEnable) {
- try {
- $index = $tpInfo->getSendWhichQueue()->getAndIncrement();
- for ($i = 0; $i < strlen($tpInfo->getMessageQueueList()); $i++) {
- $pos = abs($index++) % strlen(tpInfo.getMessageQueueList());
- if ($pos < 0)
- $pos = 0;
- $mq = $tpInfo->getMessageQueueList()->get($pos);
- if ($this->latencyFaultTolerance->isAvailable($mq->getBrokerName())) {
- if (null == $lastBrokerName || $mq->getBrokerName() == $lastBrokerName)
- return $mq;
- }
- }
-
- $notBestBroker = $this->latencyFaultTolerance->pickOneAtLeast();
- $writeQueueNums = $tpInfo->getQueueIdByBroker($notBestBroker);
- if ($writeQueueNums > 0) {
- $mq = $tpInfo->selectOneMessageQueue();
- if ($notBestBroker != null) {
- $mq->setBrokerName($notBestBroker);
- $mq->setQueueId($tpInfo->getSendWhichQueue()->getAndIncrement() % $writeQueueNums);
- }
- return $mq;
- }
- else {
- $this->latencyFaultTolerance->remove($notBestBroker);
- }
- }
- catch (\Exception $e) {
- $this->log->error("Error occurred when selecting message queue", e);
- }
-
- return $this->tpInfo->selectOneMessageQueue();
- }
-
- return $this->tpInfo->selectOneMessageQueue($lastBrokerName);
- }
- public function updateFaultItem($brokerName, $currentLatency, $isolation)
- {
-
- }
-
- public function computeNotAvailableDuration($currentLatency)
- {
-
- }
-}
diff --git a/rocketmq-php/src/Client/Producer/DefaultMQProducer.php b/rocketmq-php/src/Client/Producer/DefaultMQProducer.php
deleted file mode 100644
index 5534486..0000000
--- a/rocketmq-php/src/Client/Producer/DefaultMQProducer.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Producer;
-
-use RocketMQ\Client\Common\ClientErrorCode;
-use RocketMQ\Client\Exception\MQClientException;
-use RocketMQ\Client\Latency\MQFaultStrategy;
-use RocketMQ\Common\CommunicationMode;
-use RocketMQ\Common\Message\Message;
-use RocketMQ\Common\System;
-
-class DefaultMQProducer
-{
-
- public $mqFaultStrategy;
- public function __construct()
- {
- $this->mqfaultStrategy = new MQFaultStrategy();
-
- }
- public function start()
- {
-
- }
-
- public function shutdown()
- {
-
- }
-
-
- public function updateFaultItem($brokerName, $currentLatency, $isolation)
- {
-
- }
- /**
- * @param Message $msg
- */
- public function send($msg, $communicationMode = CommunicationMode::SYNC, $sendCallback = null, $timeout = null)
- {
- $this->makeSureStateOK();
- Validators::checkMessage($msg, $this->defaultMQProducer);
-
- $invokeID = random::nextLong();
- $beginTimestampFirst = System::currentTimeMillis(); //System.currentTimeMillis()
- $beginTimestampPrev = $beginTimestampFirst;
- $endTimestamp = $beginTimestampFirst;
- $topicPublishInfo = $this->tryToFindTopicPublishInfo($msg->getTopic());
- if ($topicPublishInfo != null && $topicPublishInfo->ok()) {
- $mq = null;
- $exception = null;
- $sendResult = null;
- $timesTotal = $communicationMode === CommunicationMode::SYNC ? 1 + $this->defaultMQProducer->getRetryTimesWhenSendFailed() : 1;
- $times = 0;
- $brokersSent = '';
- for (; $times < $timesTotal; $times++) {
- $lastBrokerName = null == $mq ? null : $mq->getBrokerName();
- $tmpmq = $this->selectOneMessageQueue($topicPublishInfo, $lastBrokerName);
- if ($tmpmq != null) {
- $mq = $tmpmq;
- $brokersSent[$times] = $mq->getBrokerName();
- try {
- $beginTimestampPrev = System::currentTimeMillis();
- $sendResult = $this->sendKernelImpl($msg, $mq, $communicationMode, $sendCallback,
- $topicPublishInfo, $timeout);
- $endTimestamp = System::currentTimeMillis();
- $this->updateFaultItem($mq->getBrokerName(), $endTimestamp - $beginTimestampPrev, false);
- switch ($communicationMode) {
- case CommunicationMode::ASYNC:
- return null;
- case CommunicationMode::ONEWAY:
- return null;
- case CommunicationMode::SYNC:
- if ($sendResult->getSendStatus() != SendStatus::SEND_OK) {
- $this->defaultMQProducer->isRetryAnotherBrokerWhenNotStoreOK();
- }
-
- return $sendResult;
- default:
- break;
- }
- } catch (\Exception $e) {
- $endTimestamp = System::currentTimeMillis();
- $this->updateFaultItem($mq->getBrokerName(), $endTimestamp - $beginTimestampPrev, true);
- $this->log->warn(sprintf("sendKernelImpl exception, resend at once, InvokeID: %s, RT: %sms, Broker: %s",
- invokeID, endTimestamp - beginTimestampPrev, mq), $e);
- $this->log->warn($msg->toString());
-
-
- if ($sendResult != null) {
- return $sendResult;
- }
-
- $info = sprintf("Send [%d] times, still failed, cost [%d]ms, Topic: %s, BrokersSent: %s",
- $times,
- System::currentTimeMillis() - $beginTimestampFirst,
- $msg->getTopic(),
- var_export($brokersSent, 1));
-
- $info += FAQUrl::suggestTodo(FAQUrl::SEND_MSG_FAILED);
-
- $mqClientException = new MQClientException($info, $exception);
-
- throw $mqClientException;
- }
-
- $nsList = $this->getmQClientFactory()->getMQClientAPIImpl()->getNameServerAddressList();
- if (null == $nsList || $nsList->isEmpty()) {
- throw (new MQClientException(
- "No name server address, please set it->" + FAQUrl::suggestTodo(FAQUrl::NAME_SERVER_ADDR_NOT_EXIST_URL),
- null))->setResponseCode(ClientErrorCode::NO_NAME_SERVER_EXCEPTION);
- }
-
- throw (new MQClientException("No route info of this topic, " + $msg->getTopic() + FAQUrl::suggestTodo(FAQUrl::NO_TOPIC_ROUTE_INFO),
- null))->setResponseCode(ClientErrorCode::NOT_FOUND_TOPIC_EXCEPTION);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Client/Producer/SendStatus.php b/rocketmq-php/src/Client/Producer/SendStatus.php
deleted file mode 100644
index 0527d42..0000000
--- a/rocketmq-php/src/Client/Producer/SendStatus.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Client\Producer;
-
-class SendStatus
-{
- const SEND_OK = 0;
- const FLUSH_DISK_TIMEOUT = 1;
- const FLUSH_SLAVE_TIMEOUT = 2;
- const SLAVE_NOT_AVAILABLE = 3;
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Common/CommunicationMode.php b/rocketmq-php/src/Common/CommunicationMode.php
deleted file mode 100644
index ab7cc33..0000000
--- a/rocketmq-php/src/Common/CommunicationMode.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Common;
-
-class CommunicationMode
-{
- const SYNC = 0;
- const ASYNC = 1;
- const ONEWAY = 2;
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Common/Help/FAQUrl.php b/rocketmq-php/src/Common/Help/FAQUrl.php
deleted file mode 100644
index fbfbc65..0000000
--- a/rocketmq-php/src/Common/Help/FAQUrl.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Common\Help;
-
-class FAQUrl
-{
- const APPLY_TOPIC_URL = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const NAME_SERVER_ADDR_NOT_EXIST_URL = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const GROUP_NAME_DUPLICATE_URL = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const CLIENT_PARAMETER_CHECK_URL = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const SUBSCRIPTION_GROUP_NOT_EXIST = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const CLIENT_SERVICE_NOT_OK = //
- "http://rocketmq.apache.org/docs/faq/";
-
- // FAQ: No route info of this topic, TopicABC
- const NO_TOPIC_ROUTE_INFO = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const LOAD_JSON_EXCEPTION = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const SAME_GROUP_DIFFERENT_TOPIC = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const MQLIST_NOT_EXIST = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const UNEXPECTED_EXCEPTION_URL = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const SEND_MSG_FAILED = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const UNKNOWN_HOST_EXCEPTION = //
- "http://rocketmq.apache.org/docs/faq/";
-
- const TIP_STRING_BEGIN = "\nSee ";
- const TIP_STRING_END = " for further details.";
-
- public static function suggestTodo($url)
- {
- return static::TIP_STRING_BEGIN . $url . static::TIP_STRING_END;
- }
-
- public static function attachDefaultURL($errorMessage)
- {
- if ($errorMessage !== null) {
- $index = strpos($errorMessage, static::TIP_STRING_BEGIN);
- if (false === $index) {
- return $errorMessage . "\n" . "For more information, please visit the url, " . static::UNEXPECTED_EXCEPTION_URL;
- }
- }
-
- return $errorMessage;
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Common/Message/Message.php b/rocketmq-php/src/Common/Message/Message.php
deleted file mode 100644
index eb6c3f6..0000000
--- a/rocketmq-php/src/Common/Message/Message.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Common\Message;
-
-class Message
-{
-
- private $serialVersionUID = 8445773977080406428;
- private $topic;
- private $flag;
- private $properties;
- private $body;
-
- public function __construct(...$args)
- {
- $c = count($args);
- switch ($c) {
- case 0:
- break;
- case 2:
- $this->initMessage($args[0], "", "", 0, $args[1], true);
- break;
- case 3:
- $this->initMessage($args[0], $args[1], "", 0, $args[2], true);
- break;
- case 4:
- $this->initMessage($args[0], $args[1], $args[2], 0, $args[3], true);
- break;
-
- }
-
- }
-
- public function initMessage($topic, $tags, $keys = '', $flag = 0, $body, $waitStoreMsgOK)
- {
- $this->topic = $topic;
- $this->flag = $flag;
- $this->body = $body;
- if (null !== $tag && strlen($tags) > 0) {
- $this->setTags(tags);
- }
- if (null !== $keys && strlen($keys) > 0) {
- $this->setKeys($keys);
- }
- $this->setWaitStoreMsgOk($waitStoreMsgOK);
- }
-
- public function putProperty($name, $value)
- {
- if (null === $this->properties) {
- $this->properties = [];
- }
- $this->properties[$name] = $value;
- }
-
- public function clearProperty($name)
- {
- if (null === $this->properties) {
- unset($this->properties[$name]);
- }
- }
-
- public function putUserProperty($name, $value)
- {
- //TODO
- }
-
- public function getUserProperty($name)
- {
- return $this->getProperty($name);
- }
-
- public function getProperty($name)
- {
- if (null === $this->properties) {
- $this->properties = [];
- }
- return (array_key_exists($name, $this->properties)) ? $this->properties[$name] : null;
- }
-
- public function gtTopic()
- {
- return $this->topic;
- }
-
- public function setTopic($topic)
- {
- $this->topic = $topic;
- }
-
- public function getTags()
- {
- return $this->getProperty(MessageConst::PROPERTY_TAGS);
- }
-
- public function setTags($tags)
- {
- $this->putProperty(MessageConst::PROPERTY_TAGS, $tags);
- }
-
- public function setKeys($keys)
- {
- $keys = implode(MessageConst::KEY_SEPARATOR, $keys);
- $this->putProperty(MessageConst::PROPERTY_KEYS, $keys);
- }
-
- public function getKeys()
- {
- return $this->getProperty(MessageConst::PROPERTY_KEYS);
- }
-
- public function setWaitStroreMsgOk($waitStoreMsgOK)
- {
-
- }
-
- public function getDelayTimeLevel()
- {
- $t = $this->getProperty(MessageConst . PROPERTY_DELAY_TIME_LEVEL);
- if ($t !== null) {
- return (int)$t;
- }
-
- return 0;
- }
-
- public function setDelayTimeLevel($level)
- {
- $this->putProperty(MessageConst::PROPERTY_DELAY_TIME_LEVEL, $level);
- }
-
- public function isWaitStoreMsgOK()
- {
- $result = $this->getProperty(MessageConst::PROPERTY_WAIT_STORE_MSG_OK);
- if (null === $result) {
- return true;
- }
-
- return (bool)$result;
- }
-
- public function setWaitStoreMsgOK($waitStoreMsgOK)
- {
- $this->putProperty(MessageConst::PROPERTY_WAIT_STORE_MSG_OK, $waitStoreMsgOK);
- }
-
- public function getFlag()
- {
- return $this->flag;
- }
-
- public function setFlag($flag)
- {
- $this->flag = $flag;
- }
-
- public function getBody()
- {
- return $this->body;
- }
-
- public function setBody($body)
- {
- $this->body = $body;
- }
-
- public function getProperties()
- {
- return $this->properties;
- }
-
- public function setProperties($properties)
- {
- $this->properties = $properties;
- }
-
- public function getBuyerId()
- {
- return $this->getProperty(MessageConst::PROPERTY_BUYER_ID);
- }
-
- public function setBuyerId($buyerId)
- {
- $this->putProperty(MessageConst::PROPERTY_BUYER_ID, $buyerId);
- }
-
-
- public function toString()
- {
- return "Message [topic=" . $this->topic . ", flag=" . $this->flag . ", properties=" . $this->properties . ", body="
- . ($this->body != null ? strlen($this->body) : 0) . "]";
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Common/Message/MessageConst.php b/rocketmq-php/src/Common/Message/MessageConst.php
deleted file mode 100644
index fbd32b2..0000000
--- a/rocketmq-php/src/Common/Message/MessageConst.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Common\Message;
-
-class MessageConst
-{
- const PROPERTY_KEYS = "KEYS";
- const PROPERTY_TAGS = "TAGS";
- const PROPERTY_WAIT_STORE_MSG_OK = "WAIT";
- const PROPERTY_DELAY_TIME_LEVEL = "DELAY";
- const PROPERTY_RETRY_TOPIC = "RETRY_TOPIC";
- const PROPERTY_REAL_TOPIC = "REAL_TOPIC";
- const PROPERTY_REAL_QUEUE_ID = "REAL_QID";
- const PROPERTY_TRANSACTION_PREPARED = "TRAN_MSG";
- const PROPERTY_PRODUCER_GROUP = "PGROUP";
- const PROPERTY_MIN_OFFSET = "MIN_OFFSET";
- const PROPERTY_MAX_OFFSET = "MAX_OFFSET";
- const PROPERTY_BUYER_ID = "BUYER_ID";
- const PROPERTY_ORIGIN_MESSAGE_ID = "ORIGIN_MESSAGE_ID";
- const PROPERTY_TRANSFER_FLAG = "TRANSFER_FLAG";
- const PROPERTY_CORRECTION_FLAG = "CORRECTION_FLAG";
- const PROPERTY_MQ2_FLAG = "MQ2_FLAG";
- const PROPERTY_RECONSUME_TIME = "RECONSUME_TIME";
- const PROPERTY_MSG_REGION = "MSG_REGION";
- const PROPERTY_TRACE_SWITCH = "TRACE_ON";
- const PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX = "UNIQ_KEY";
- const PROPERTY_MAX_RECONSUME_TIMES = "MAX_RECONSUME_TIMES";
- const PROPERTY_CONSUME_START_TIMESTAMP = "CONSUME_START_TIME";
-
- const KEY_SEPARATOR = " ";
-
- const STRING_HASH_SET = [
- PROPERTY_TRACE_SWITCH,
- PROPERTY_MSG_REGION,
- PROPERTY_KEYS,
- PROPERTY_TAGS,
- PROPERTY_WAIT_STORE_MSG_OK,
- PROPERTY_DELAY_TIME_LEVEL,
- PROPERTY_RETRY_TOPIC,
- PROPERTY_REAL_TOPIC,
- PROPERTY_REAL_QUEUE_ID,
- PROPERTY_TRANSACTION_PREPARED,
- PROPERTY_PRODUCER_GROUP,
- PROPERTY_MIN_OFFSET,
- PROPERTY_MAX_OFFSET,
- PROPERTY_BUYER_ID,
- PROPERTY_ORIGIN_MESSAGE_ID,
- PROPERTY_TRANSFER_FLAG,
- PROPERTY_CORRECTION_FLAG,
- PROPERTY_MQ2_FLAG,
- PROPERTY_RECONSUME_TIME,
- PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX,
- PROPERTY_MAX_RECONSUME_TIMES,
- PROPERTY_CONSUME_START_TIMESTAMP
- ];
-}
diff --git a/rocketmq-php/src/Common/System.php b/rocketmq-php/src/Common/System.php
deleted file mode 100644
index e18b282..0000000
--- a/rocketmq-php/src/Common/System.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Common;
-
-class System
-{
- /**
- * Get java like time millis
- * @return mixed
- */
- public static function currentTimeMillis()
- {
- return microtime(true) * 10000;
- }
-}
\ No newline at end of file
diff --git a/rocketmq-php/src/Remoting/Common/RemotingHelper.php b/rocketmq-php/src/Remoting/Common/RemotingHelper.php
deleted file mode 100644
index 3c151ae..0000000
--- a/rocketmq-php/src/Remoting/Common/RemotingHelper.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * 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.
- */
-namespace RocketMQ\Remoting\Common;
-
-class RemotingHelper
-{
-
-}
\ No newline at end of file
diff --git a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/RmqSourceTask.java b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/RmqSourceTask.java
index b16e585..42dbab8 100644
--- a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/RmqSourceTask.java
+++ b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/RmqSourceTask.java
@@ -76,6 +76,10 @@
List<TaskTopicInfo> topicList = JSONObject.parseArray(this.config.getTaskTopicList(), TaskTopicInfo.class);
try {
+ if (topicList == null) {
+ throw new IllegalStateException("topicList is null");
+ }
+
this.consumer.start();
for (TaskTopicInfo tti : topicList) {
Set<MessageQueue> mqs = consumer.fetchSubscribeMessageQueues(tti.getTopic());
diff --git a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/config/TaskTopicInfo.java b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/config/TaskTopicInfo.java
index 1086295..3e2962b 100644
--- a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/config/TaskTopicInfo.java
+++ b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/config/TaskTopicInfo.java
@@ -18,7 +18,7 @@
import org.apache.rocketmq.common.message.MessageQueue;
-public class TaskTopicInfo extends MessageQueue{
+public class TaskTopicInfo extends MessageQueue {
private String targetTopic;
diff --git a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/strategy/DivideTaskByQueue.java b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/strategy/DivideTaskByQueue.java
index d6a15ad..d909873 100644
--- a/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/strategy/DivideTaskByQueue.java
+++ b/rocketmq-replicator/src/main/java/org/apache/rocketmq/replicator/strategy/DivideTaskByQueue.java
@@ -16,8 +16,13 @@
*/
package org.apache.rocketmq.replicator.strategy;
+import com.alibaba.fastjson.JSONObject;
import io.openmessaging.KeyValue;
+import io.openmessaging.internal.DefaultKeyValue;
+import java.util.HashMap;
import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.replicator.config.DataType;
+import org.apache.rocketmq.replicator.config.TaskConfigEnum;
import org.apache.rocketmq.replicator.config.TaskDivideConfig;
import java.util.ArrayList;
import java.util.List;
@@ -28,13 +33,29 @@
public List<KeyValue> divide(Map<String, List<TaskTopicInfo>> topicRouteMap, TaskDivideConfig tdc) {
List<KeyValue> config = new ArrayList<KeyValue>();
-
+ int parallelism = tdc.getTaskParallelism();
+ Map<Integer, List<TaskTopicInfo>> queueTopicList = new HashMap<Integer, List<TaskTopicInfo>>();
+ int id = -1;
for (String t : topicRouteMap.keySet()) {
for (TaskTopicInfo taskTopicInfo : topicRouteMap.get(t)) {
+ int ind = ++id % parallelism;
+ if (!queueTopicList.containsKey(ind)) {
+ queueTopicList.put(ind, new ArrayList<TaskTopicInfo>());
+ }
+ queueTopicList.get(ind).add(taskTopicInfo);
}
}
- return config;
+ for (int i = 0; i < parallelism; i++) {
+ KeyValue keyValue = new DefaultKeyValue();
+ keyValue.put(TaskConfigEnum.TASK_STORE_ROCKETMQ.getKey(), tdc.getStoreTopic());
+ keyValue.put(TaskConfigEnum.TASK_SOURCE_ROCKETMQ.getKey(), tdc.getSourceNamesrvAddr());
+ keyValue.put(TaskConfigEnum.TASK_DATA_TYPE.getKey(), DataType.COMMON_MESSAGE.ordinal());
+ keyValue.put(TaskConfigEnum.TASK_TOPIC_INFO.getKey(), JSONObject.toJSONString(queueTopicList.get(i)));
+ keyValue.put(TaskConfigEnum.TASK_SOURCE_RECORD_CONVERTER.getKey(), tdc.getSrcRecordConverter());
+ config.add(keyValue);
+ }
+ return config;
}
}