> configTable) {
37 | this.configTable = configTable;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/ChannelEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting;
18 |
19 | import io.netty.channel.Channel;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | *
25 | */
26 | public interface ChannelEventListener {
27 | void onChannelConnect(final String remoteAddr, final Channel channel);
28 |
29 |
30 | void onChannelClose(final String remoteAddr, final Channel channel);
31 |
32 |
33 | void onChannelException(final String remoteAddr, final Channel channel);
34 |
35 |
36 | void onChannelIdle(final String remoteAddr, final Channel channel);
37 | }
38 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/CommandCustomHeader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting;
18 |
19 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | */
25 | public interface CommandCustomHeader {
26 | void checkFields() throws RemotingCommandException;
27 | }
28 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/InvokeCallback.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting;
18 |
19 | import com.alibaba.rocketmq.remoting.netty.ResponseFuture;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | *
25 | */
26 | public interface InvokeCallback {
27 | public void operationComplete(final ResponseFuture responseFuture);
28 | }
29 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/RPCHook.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.remoting;
19 |
20 | import com.alibaba.rocketmq.remoting.protocol.RemotingCommand;
21 |
22 |
23 | public interface RPCHook {
24 | void doBeforeRequest(final String remoteAddr, final RemotingCommand request);
25 |
26 |
27 | void doAfterResponse(final String remoteAddr, final RemotingCommand request,
28 | final RemotingCommand response);
29 | }
30 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/RemotingService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.remoting;
19 |
20 | public interface RemotingService {
21 | void start();
22 |
23 |
24 | void shutdown();
25 |
26 |
27 | void registerRPCHook(RPCHook rpcHook);
28 | }
29 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/annotation/CFNotNull.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.annotation;
18 |
19 | import java.lang.annotation.*;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | */
25 | @Documented
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
28 | public @interface CFNotNull {
29 | }
30 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/annotation/CFNullable.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.annotation;
18 |
19 | import java.lang.annotation.*;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | */
25 | @Documented
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
28 | public @interface CFNullable {
29 | }
30 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/exception/RemotingCommandException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.exception;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public class RemotingCommandException extends RemotingException {
23 | private static final long serialVersionUID = -6061365915274953096L;
24 |
25 |
26 | public RemotingCommandException(String message) {
27 | super(message, null);
28 | }
29 |
30 |
31 | public RemotingCommandException(String message, Throwable cause) {
32 | super(message, cause);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/exception/RemotingConnectException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.exception;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public class RemotingConnectException extends RemotingException {
23 | private static final long serialVersionUID = -5565366231695911316L;
24 |
25 |
26 | public RemotingConnectException(String addr) {
27 | this(addr, null);
28 | }
29 |
30 |
31 | public RemotingConnectException(String addr, Throwable cause) {
32 | super("connect to <" + addr + "> failed", cause);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/exception/RemotingException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.exception;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public class RemotingException extends Exception {
23 | private static final long serialVersionUID = -5690687334570505110L;
24 |
25 |
26 | public RemotingException(String message) {
27 | super(message);
28 | }
29 |
30 |
31 | public RemotingException(String message, Throwable cause) {
32 | super(message, cause);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/exception/RemotingSendRequestException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.exception;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public class RemotingSendRequestException extends RemotingException {
23 | private static final long serialVersionUID = 5391285827332471674L;
24 |
25 |
26 | public RemotingSendRequestException(String addr) {
27 | this(addr, null);
28 | }
29 |
30 |
31 | public RemotingSendRequestException(String addr, Throwable cause) {
32 | super("send request to <" + addr + "> failed", cause);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/exception/RemotingTooMuchRequestException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.exception;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public class RemotingTooMuchRequestException extends RemotingException {
23 | private static final long serialVersionUID = 4326919581254519654L;
24 |
25 |
26 | public RemotingTooMuchRequestException(String message) {
27 | super(message);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyEventType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.netty;
18 |
19 | /**
20 | * @author shijia.wxr
21 | *
22 | */
23 | public enum NettyEventType {
24 | CONNECT,
25 | CLOSE,
26 | IDLE,
27 | EXCEPTION
28 | }
29 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/netty/NettyRequestProcessor.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.netty;
18 |
19 | import com.alibaba.rocketmq.remoting.protocol.RemotingCommand;
20 | import io.netty.channel.ChannelHandlerContext;
21 |
22 |
23 | /**
24 | * Common remoting command processor
25 | *
26 | * @author shijia.wxr
27 | *
28 | */
29 | public interface NettyRequestProcessor {
30 | RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request)
31 | throws Exception;
32 | boolean rejectRequest();
33 | }
34 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/protocol/RemotingCommandType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.remoting.protocol;
18 |
19 | /**
20 | * @author shijia.wxr
21 | *
22 | */
23 | public enum RemotingCommandType {
24 | REQUEST_COMMAND,
25 | RESPONSE_COMMAND;
26 | }
27 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/protocol/RemotingSysResponseCode.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.remoting.protocol;
19 |
20 | public class RemotingSysResponseCode {
21 |
22 | public static final int SUCCESS = 0;
23 |
24 | public static final int SYSTEM_ERROR = 1;
25 |
26 | public static final int SYSTEM_BUSY = 2;
27 |
28 | public static final int REQUEST_CODE_NOT_SUPPORTED = 3;
29 |
30 | public static final int TRANSACTION_FAILED = 4;
31 | }
32 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/protocol/SerializeType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.remoting.protocol;
19 |
20 | public enum SerializeType {
21 | JSON((byte) 0),
22 | ROCKETMQ((byte) 1);
23 |
24 | private byte code;
25 |
26 | SerializeType(byte code) {
27 | this.code = code;
28 | }
29 |
30 | public static SerializeType valueOf(byte code) {
31 | for (SerializeType serializeType : SerializeType.values()) {
32 | if (serializeType.getCode() == code) {
33 | return serializeType;
34 | }
35 | }
36 | return null;
37 | }
38 |
39 | public byte getCode() {
40 | return code;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/protocol/protocol.sevialize.txt:
--------------------------------------------------------------------------------
1 | //
2 | // Remoting protocol V0.1 draft
3 | //
4 | // protocol
5 | // 1 2 3 4
6 | //
--------------------------------------------------------------------------------
/rocketmq-remoting/src/main/java/com/alibaba/rocketmq/remoting/protocol/protocol.txt:
--------------------------------------------------------------------------------
1 | //
2 | // Remoting protocol V0.1 draft
3 | //
4 | // protocol
5 | // 1 2 3 4
6 | //
7 |
--------------------------------------------------------------------------------
/rocketmq-remoting/src/test/java/com/alibaba/rocketmq/subclass/TestSubClassAuto.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | /**
19 | *
20 | */
21 | package com.alibaba.rocketmq.subclass;
22 |
23 | import org.junit.Test;
24 |
25 |
26 | /**
27 | * @author shijia.wxr
28 | */
29 | public class TestSubClassAuto {
30 | @Test
31 | public void test_sub() {
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rocketmq-srvutil/src/test/java/com/alibaba/rocketmq/srvutil/ServerUtilTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.srvutil;
19 |
20 | import org.junit.Test;
21 |
22 |
23 | public class ServerUtilTest {
24 | @Test
25 | public void test1() {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/rocketmq-store/sbin/map.sh:
--------------------------------------------------------------------------------
1 | /opt/taobao/java/bin/java -server -Xms2g -Xmx2g -XX:NewSize=512M -XX:MaxNewSize=1g -XX:PermSize=256m -XX:MaxPermSize=256m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp ../target/metaq-store-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/metaq/metaq/metaq-commons/target/metaq-commons-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar com.taobao.metaq.store.inspect.TestMmap 1024 16384
--------------------------------------------------------------------------------
/rocketmq-store/sbin/put.sh:
--------------------------------------------------------------------------------
1 | /opt/taobao/java/bin/java -server -Xms2g -Xmx2g -XX:NewSize=512M -XX:MaxNewSize=1g -XX:PermSize=256m -XX:MaxPermSize=256m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp ../target/metaq-store-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/metaq/metaq/metaq-commons/target/metaq-commons-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar com.taobao.metaq.store.inspect.TestPutGetMessage -1 2048 512 true
--------------------------------------------------------------------------------
/rocketmq-store/sbin/response.sh:
--------------------------------------------------------------------------------
1 | /opt/taobao/java/bin/java -server -Xms2g -Xmx2g -XX:NewSize=512M -XX:MaxNewSize=1g -XX:PermSize=256m -XX:MaxPermSize=256m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp ../target/metaq-store-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/metaq/metaq/metaq-commons/target/metaq-commons-2.0.0-SNAPSHOT.jar:/home/shijia.wxr/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar com.taobao.metaq.store.inspect.TestPutResponse -1 512
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showcpu.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | ps -eo "%p %C %c" |grep java
5 | sleep 1
6 | done
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showdirty.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | NOW=`date +%H%M%S`
5 | output=dirty.`date +%Y%m%d`
6 | DIRTY=`cat /proc/vmstat |grep nr_dirty`
7 | echo $NOW $DIRTY >> $output
8 | sleep 1
9 | done
10 |
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showdirty2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | dirty=`cat /proc/vmstat |grep nr_dirty|awk '{print $2}'`
5 | total=`cat /proc/vmstat |grep nr_file_pages|awk '{print $2}'`
6 | ratio=`echo "scale=4; $dirty/$total * 100" | bc`
7 | echo "$dirty $total ${ratio}%"
8 | sleep 1
9 | done
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showiostat.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | iostat sdb1 -x 1 -t
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showload.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | uptime
5 | sleep 1
6 | done
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showmap.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ps ax | grep -i 'com.taobao.metaq' |grep java | grep -v grep | awk '{print $1}' | xargs pmap |grep metastore
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showmaptotal.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | ps ax | grep -i 'com.taobao.metaq' |grep java | grep -v grep | awk '{print $1}' | xargs pmap |grep metastore |wc -l
5 | sleep 1
6 | done
7 |
--------------------------------------------------------------------------------
/rocketmq-store/sbin/showvmstat.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | while [ "1" == "1" ]
3 | do
4 | date
5 | cat /proc/vmstat |egrep "nr_free_pages|nr_anon_pages|nr_file_pages|nr_dirty|nr_writeback|pgpgout|pgsteal_normal|pgscan_kswapd_normal|pgscan_direct_normal|kswapd_steal"
6 | echo
7 | sleep 1
8 | done
9 |
--------------------------------------------------------------------------------
/rocketmq-store/sbin/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | nohup sh put.sh > put.txt &
3 | nohup sh showload.sh > load.txt &
4 | nohup sh showiostat.sh > iostat.txt &
5 | nohup sh showmaptotal.sh > map.txt &
6 | nohup sh showcpu.sh > cpu.txt &
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/AppendMessageCallback.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store;
18 |
19 | import java.nio.ByteBuffer;
20 |
21 |
22 | /**
23 | * Write messages callback interface
24 | *
25 | * @author shijia.wxr
26 | *
27 | */
28 | public interface AppendMessageCallback {
29 |
30 | /**
31 | * After message serialization, write MapedByteBuffer
32 | *
33 | * @param byteBuffer
34 | * @param maxBlank
35 | * @param msg
36 | *
37 | * @return How many bytes to write
38 | */
39 | public AppendMessageResult doAppend(final long fileFromOffset, final ByteBuffer byteBuffer,
40 | final int maxBlank, final Object msg);
41 | }
42 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/AppendMessageStatus.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store;
18 |
19 | /**
20 | * When write a message to the commit log, returns code
21 | *
22 | * @author shijia.wxr
23 | *
24 | */
25 | public enum AppendMessageStatus {
26 | PUT_OK,
27 | END_OF_FILE,
28 | MESSAGE_SIZE_EXCEEDED,
29 | PROPERTIES_SIZE_EXCEEDED,
30 | UNKNOWN_ERROR,
31 | }
32 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/GetMessageStatus.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public enum GetMessageStatus {
23 |
24 | FOUND,
25 |
26 | NO_MATCHED_MESSAGE,
27 |
28 | MESSAGE_WAS_REMOVING,
29 |
30 | OFFSET_FOUND_NULL,
31 |
32 | OFFSET_OVERFLOW_BADLY,
33 |
34 | OFFSET_OVERFLOW_ONE,
35 |
36 | OFFSET_TOO_SMALL,
37 |
38 | NO_MATCHED_LOGIC_QUEUE,
39 |
40 | NO_MESSAGE_IN_QUEUE,
41 | }
42 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MessageArrivingListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.store;
19 |
20 | public interface MessageArrivingListener {
21 | void arriving(String topic, int queueId, long logicOffset, long tagsCode);
22 | }
23 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MessageFilter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store;
18 |
19 | import com.alibaba.rocketmq.common.protocol.heartbeat.SubscriptionData;
20 |
21 |
22 | /**
23 | * @author shijia.wxr
24 | */
25 | public interface MessageFilter {
26 | boolean isMessageMatched(final SubscriptionData subscriptionData, final Long tagsCode);
27 | }
28 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/PutMessageStatus.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public enum PutMessageStatus {
23 | PUT_OK,
24 | FLUSH_DISK_TIMEOUT,
25 | FLUSH_SLAVE_TIMEOUT,
26 | SLAVE_NOT_AVAILABLE,
27 | SERVICE_NOT_AVAILABLE,
28 | CREATE_MAPEDFILE_FAILED,
29 | MESSAGE_ILLEGAL,
30 | PROPERTIES_SIZE_EXCEEDED,
31 | OS_PAGECACHE_BUSY,
32 | UNKNOWN_ERROR,
33 | }
34 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/config/BrokerRole.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store.config;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public enum BrokerRole {
23 | ASYNC_MASTER,
24 | SYNC_MASTER,
25 | SLAVE;
26 | }
27 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/config/FlushDiskType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store.config;
18 |
19 | /**
20 | * @author shijia.wxr
21 | */
22 | public enum FlushDiskType {
23 | SYNC_FLUSH,
24 | ASYNC_FLUSH
25 | }
26 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/transaction/TransactionCheckExecuter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store.transaction;
18 |
19 | public interface TransactionCheckExecuter {
20 | public void gotoCheck(//
21 | final int producerGroupHashCode,//
22 | final long tranStateTableOffset,//
23 | final long commitLogOffset,//
24 | final int msgSize);
25 | }
26 |
--------------------------------------------------------------------------------
/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/util/LibC.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.store.util;
18 |
19 | import com.sun.jna.Library;
20 | import com.sun.jna.Native;
21 | import com.sun.jna.NativeLong;
22 | import com.sun.jna.Platform;
23 | import com.sun.jna.Pointer;
24 |
25 |
26 | public interface LibC extends Library {
27 | LibC INSTANCE = (LibC) Native.loadLibrary(Platform.isWindows() ? "msvcrt" : "c", LibC.class);
28 |
29 | int MADV_WILLNEED = 3;
30 | int MADV_DONTNEED = 4;
31 |
32 | int mlock(Pointer var1, NativeLong var2);
33 |
34 | int munlock(Pointer var1, NativeLong var2);
35 |
36 | int madvise(Pointer var1, NativeLong var2, int var3);
37 | }
38 |
--------------------------------------------------------------------------------
/rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/admin/api/TrackType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.tools.admin.api;
19 |
20 | public enum TrackType {
21 | CONSUMED,
22 | CONSUMED_BUT_FILTERED,
23 | PULL,
24 | NOT_CONSUME_YET,
25 | NOT_ONLINE,
26 | UNKNOWN
27 | }
28 |
--------------------------------------------------------------------------------
/rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/SubCommand.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.alibaba.rocketmq.tools.command;
18 |
19 | import com.alibaba.rocketmq.remoting.RPCHook;
20 | import org.apache.commons.cli.CommandLine;
21 | import org.apache.commons.cli.Options;
22 |
23 |
24 | /**
25 | * @author shijia.wxr
26 | */
27 | public interface SubCommand {
28 | public String commandName();
29 |
30 |
31 | public String commandDesc();
32 |
33 |
34 | public Options buildCommandlineOptions(final Options options);
35 |
36 |
37 | public void execute(final CommandLine commandLine, final Options options, RPCHook rpcHook);
38 | }
39 |
--------------------------------------------------------------------------------
/rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/command/topic/RebalanceResult.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.tools.command.topic;
19 |
20 | import com.alibaba.rocketmq.common.message.MessageQueue;
21 |
22 | import java.util.HashMap;
23 | import java.util.List;
24 | import java.util.Map;
25 |
26 | public class RebalanceResult {
27 | private Map> result = new HashMap>();
28 |
29 | public Map> getResult() {
30 | return result;
31 | }
32 |
33 | public void setResult(final Map> result) {
34 | this.result = result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/rocketmq-tools/src/main/java/com/alibaba/rocketmq/tools/monitor/MonitorListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.alibaba.rocketmq.tools.monitor;
19 |
20 | import com.alibaba.rocketmq.common.protocol.body.ConsumerRunningInfo;
21 |
22 | import java.util.TreeMap;
23 |
24 | public interface MonitorListener {
25 | void beginRound();
26 |
27 | void reportUndoneMsgs(UndoneMsgs undoneMsgs);
28 |
29 | void reportFailedMsgs(FailedMsgs failedMsgs);
30 |
31 | void reportDeleteMsgsEvent(DeleteMsgsEvent deleteMsgsEvent);
32 |
33 | void reportConsumerRunningInfo(TreeMap criTable);
34 |
35 | void endRound();
36 | }
37 |
--------------------------------------------------------------------------------
/test/consumer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # $Id: consumer.sh 1831 2013-05-16 01:39:51Z shijia.wxr $
5 | #
6 | sh ./runclass.sh com.alibaba.rocketmq.example.operation.Consumer $@
7 |
--------------------------------------------------------------------------------
/test/producer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # $Id: producer.sh 1831 2013-05-16 01:39:51Z shijia.wxr $
5 | #
6 | sh ./runclass.sh com.alibaba.rocketmq.example.operation.Producer $@
7 |
--------------------------------------------------------------------------------
/test/runclass.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # $Id: runclass.sh 857 2012-12-24 06:31:31Z shijia.wxr $
5 | #
6 |
7 | if [ $# -lt 1 ];
8 | then
9 | echo "USAGE: $0 classname opts"
10 | exit 1
11 | fi
12 |
13 | BASE_DIR=$(dirname $0)/..
14 | CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}
15 |
16 | JAVA_OPT_1="-server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=320m"
17 | JAVA_OPT_2="-XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC"
18 | JAVA_OPT_3="-verbose:gc -Xloggc:${HOME}/rocketmq_client_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
19 | JAVA_OPT_4="-XX:-OmitStackTraceInFastThrow"
20 | JAVA_OPT_5="-Djava.ext.dirs=${BASE_DIR}/lib"
21 | JAVA_OPT_6="-cp ${CLASSPATH}"
22 |
23 | if [ -z "$JAVA_HOME" ]; then
24 | JAVA_HOME=/opt/taobao/java
25 | fi
26 |
27 | JAVA="$JAVA_HOME/bin/java"
28 |
29 | JAVA_OPTS="${JAVA_OPT_1} ${JAVA_OPT_2} ${JAVA_OPT_3} ${JAVA_OPT_4} ${JAVA_OPT_5} ${JAVA_OPT_6}"
30 |
31 | $JAVA $JAVA_OPTS $@
32 |
--------------------------------------------------------------------------------