├── .gitignore ├── LICENSE ├── README.md ├── benchmark ├── consumer.sh ├── producer.sh ├── runclass.sh └── tproducer.sh ├── bin ├── README.md ├── cachedog.sh ├── cleancache.sh ├── cleancache.v1.sh ├── mqadmin ├── mqadmin.exe ├── mqadmin.xml ├── mqbroker ├── mqbroker.exe ├── mqbroker.numanode0 ├── mqbroker.numanode1 ├── mqbroker.numanode2 ├── mqbroker.numanode3 ├── mqbroker.xml ├── mqfiltersrv ├── mqfiltersrv.exe ├── mqfiltersrv.xml ├── mqnamesrv ├── mqnamesrv.exe ├── mqnamesrv.xml ├── mqshutdown ├── os.sh ├── play.sh ├── runbroker.sh ├── runserver.sh ├── setcache.sh ├── startfsrv.sh └── tools.sh ├── checkstyle └── checkstyle.xml ├── conf ├── 2m-2s-async │ ├── broker-a-s.properties │ ├── broker-a.properties │ ├── broker-b-s.properties │ └── broker-b.properties ├── 2m-2s-sync │ ├── broker-a-s.properties │ ├── broker-a.properties │ ├── broker-b-s.properties │ └── broker-b.properties ├── 2m-noslave │ ├── broker-a.properties │ └── broker-b.properties ├── logback_broker.xml ├── logback_filtersrv.xml ├── logback_namesrv.xml └── logback_tools.xml ├── deploy.bat ├── eclipse.bat ├── install.bat ├── install.sh ├── pom.xml ├── release-client.xml ├── release.xml ├── rocketmq-broker ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── alibaba │ │ │ └── rocketmq │ │ │ └── broker │ │ │ ├── BrokerController.java │ │ │ ├── BrokerPathConfigHelper.java │ │ │ ├── BrokerStartup.java │ │ │ ├── client │ │ │ ├── ClientChannelInfo.java │ │ │ ├── ClientHousekeepingService.java │ │ │ ├── ConsumerGroupInfo.java │ │ │ ├── ConsumerIdsChangeListener.java │ │ │ ├── ConsumerManager.java │ │ │ ├── DefaultConsumerIdsChangeListener.java │ │ │ ├── ProducerManager.java │ │ │ ├── net │ │ │ │ └── Broker2Client.java │ │ │ └── rebalance │ │ │ │ └── RebalanceLockManager.java │ │ │ ├── filtersrv │ │ │ ├── FilterServerManager.java │ │ │ └── FilterServerUtil.java │ │ │ ├── latency │ │ │ ├── BrokerFastFailure.java │ │ │ ├── BrokerFixedThreadPoolExecutor.java │ │ │ └── FutureTaskExt.java │ │ │ ├── longpolling │ │ │ ├── ManyPullRequest.java │ │ │ ├── NotifyMessageArrivingListener.java │ │ │ ├── PullRequest.java │ │ │ └── PullRequestHoldService.java │ │ │ ├── mqtrace │ │ │ ├── ConsumeMessageContext.java │ │ │ ├── ConsumeMessageHook.java │ │ │ ├── SendMessageContext.java │ │ │ └── SendMessageHook.java │ │ │ ├── offset │ │ │ └── ConsumerOffsetManager.java │ │ │ ├── out │ │ │ └── BrokerOuterAPI.java │ │ │ ├── pagecache │ │ │ ├── ManyMessageTransfer.java │ │ │ ├── OneMessageTransfer.java │ │ │ └── QueryMessageTransfer.java │ │ │ ├── plugin │ │ │ ├── AbstractPluginMessageStore.java │ │ │ ├── MessageStoreFactory.java │ │ │ └── MessageStorePluginContext.java │ │ │ ├── processor │ │ │ ├── AbstractSendMessageProcessor.java │ │ │ ├── AdminBrokerProcessor.java │ │ │ ├── ClientManageProcessor.java │ │ │ ├── EndTransactionProcessor.java │ │ │ ├── ForwardRequestProcessor.java │ │ │ ├── PullMessageProcessor.java │ │ │ ├── QueryMessageProcessor.java │ │ │ └── SendMessageProcessor.java │ │ │ ├── slave │ │ │ └── SlaveSynchronize.java │ │ │ ├── subscription │ │ │ └── SubscriptionGroupManager.java │ │ │ ├── topic │ │ │ └── TopicConfigManager.java │ │ │ └── transaction │ │ │ ├── DefaultTransactionCheckExecuter.java │ │ │ ├── TransactionRecord.java │ │ │ ├── TransactionStore.java │ │ │ └── jdbc │ │ │ ├── JDBCTransactionStore.java │ │ │ └── JDBCTransactionStoreConfig.java │ └── resources │ │ └── transaction.sql │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── broker │ ├── api │ ├── BrokerFastFailureTest.java │ └── SendMessageTest.java │ ├── offset │ └── ConsumerOffsetManagerTest.java │ ├── plugin │ ├── MockMessageStore.java │ ├── MockMessageStorePlugins.java │ └── PlugInTest.java │ ├── topic │ └── TopicConfigManagerTest.java │ └── transaction │ └── jdbc │ └── JDBCTransactionStoreTest.java ├── rocketmq-client ├── deploy.bat ├── install.bat ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── alibaba │ │ │ └── rocketmq │ │ │ └── client │ │ │ ├── ClientConfig.java │ │ │ ├── MQAdmin.java │ │ │ ├── MQHelper.java │ │ │ ├── QueryResult.java │ │ │ ├── Validators.java │ │ │ ├── VirtualEnvUtil.java │ │ │ ├── admin │ │ │ └── MQAdminExtInner.java │ │ │ ├── common │ │ │ ├── ClientErrorCode.java │ │ │ └── ThreadLocalIndex.java │ │ │ ├── consumer │ │ │ ├── AllocateMessageQueueStrategy.java │ │ │ ├── DefaultMQPullConsumer.java │ │ │ ├── DefaultMQPushConsumer.java │ │ │ ├── MQConsumer.java │ │ │ ├── MQPullConsumer.java │ │ │ ├── MQPullConsumerScheduleService.java │ │ │ ├── MQPushConsumer.java │ │ │ ├── MessageQueueListener.java │ │ │ ├── PullCallback.java │ │ │ ├── PullResult.java │ │ │ ├── PullStatus.java │ │ │ ├── PullTaskCallback.java │ │ │ ├── PullTaskContext.java │ │ │ ├── listener │ │ │ │ ├── ConsumeConcurrentlyContext.java │ │ │ │ ├── ConsumeConcurrentlyStatus.java │ │ │ │ ├── ConsumeOrderlyContext.java │ │ │ │ ├── ConsumeOrderlyStatus.java │ │ │ │ ├── MessageListener.java │ │ │ │ ├── MessageListenerConcurrently.java │ │ │ │ └── MessageListenerOrderly.java │ │ │ ├── rebalance │ │ │ │ ├── AllocateMessageQueueAveragely.java │ │ │ │ ├── AllocateMessageQueueAveragelyByCircle.java │ │ │ │ ├── AllocateMessageQueueByConfig.java │ │ │ │ └── AllocateMessageQueueByMachineRoom.java │ │ │ └── store │ │ │ │ ├── LocalFileOffsetStore.java │ │ │ │ ├── OffsetSerializeWrapper.java │ │ │ │ ├── OffsetStore.java │ │ │ │ ├── ReadOffsetType.java │ │ │ │ └── RemoteBrokerOffsetStore.java │ │ │ ├── exception │ │ │ ├── MQBrokerException.java │ │ │ └── MQClientException.java │ │ │ ├── hook │ │ │ ├── CheckForbiddenContext.java │ │ │ ├── CheckForbiddenHook.java │ │ │ ├── ConsumeMessageContext.java │ │ │ ├── ConsumeMessageHook.java │ │ │ ├── FilterMessageContext.java │ │ │ ├── FilterMessageHook.java │ │ │ ├── SendMessageContext.java │ │ │ └── SendMessageHook.java │ │ │ ├── impl │ │ │ ├── ClientRemotingProcessor.java │ │ │ ├── CommunicationMode.java │ │ │ ├── FindBrokerResult.java │ │ │ ├── MQAdminImpl.java │ │ │ ├── MQClientAPIImpl.java │ │ │ ├── MQClientManager.java │ │ │ ├── consumer │ │ │ │ ├── ConsumeMessageConcurrentlyService.java │ │ │ │ ├── ConsumeMessageOrderlyService.java │ │ │ │ ├── ConsumeMessageService.java │ │ │ │ ├── DefaultMQPullConsumerImpl.java │ │ │ │ ├── DefaultMQPushConsumerImpl.java │ │ │ │ ├── MQConsumerInner.java │ │ │ │ ├── MessageQueueLock.java │ │ │ │ ├── ProcessQueue.java │ │ │ │ ├── PullAPIWrapper.java │ │ │ │ ├── PullMessageService.java │ │ │ │ ├── PullRequest.java │ │ │ │ ├── PullResultExt.java │ │ │ │ ├── RebalanceImpl.java │ │ │ │ ├── RebalancePullImpl.java │ │ │ │ ├── RebalancePushImpl.java │ │ │ │ └── RebalanceService.java │ │ │ ├── factory │ │ │ │ └── MQClientInstance.java │ │ │ └── producer │ │ │ │ ├── DefaultMQProducerImpl.java │ │ │ │ ├── MQProducerInner.java │ │ │ │ └── TopicPublishInfo.java │ │ │ ├── latency │ │ │ ├── LatencyFaultTolerance.java │ │ │ ├── LatencyFaultToleranceImpl.java │ │ │ └── MQFaultStrategy.java │ │ │ ├── log │ │ │ └── ClientLogger.java │ │ │ ├── producer │ │ │ ├── DefaultMQProducer.java │ │ │ ├── LocalTransactionExecuter.java │ │ │ ├── LocalTransactionState.java │ │ │ ├── MQProducer.java │ │ │ ├── MessageQueueSelector.java │ │ │ ├── SendCallback.java │ │ │ ├── SendResult.java │ │ │ ├── SendStatus.java │ │ │ ├── TransactionCheckListener.java │ │ │ ├── TransactionMQProducer.java │ │ │ ├── TransactionSendResult.java │ │ │ └── selector │ │ │ │ ├── SelectMessageQueueByHash.java │ │ │ │ ├── SelectMessageQueueByMachineRoom.java │ │ │ │ └── SelectMessageQueueByRandoom.java │ │ │ └── stat │ │ │ └── ConsumerStatsManager.java │ └── resources │ │ ├── log4j_rocketmq_client.xml │ │ └── logback_rocketmq_client.xml │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── client │ ├── LatencyFaultToleranceImplTest.java │ ├── SimpleConsumerProducerTest.java │ ├── ThreadLocalIndexTest.java │ ├── ValidatorsTest.java │ └── consumer │ └── loadbalance │ └── AllocateMessageQueueAveragelyTest.java ├── rocketmq-common ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ └── common │ │ ├── BrokerConfig.java │ │ ├── BrokerConfigSingleton.java │ │ ├── ConfigManager.java │ │ ├── DataVersion.java │ │ ├── MQVersion.java │ │ ├── MixAll.java │ │ ├── Pair.java │ │ ├── ServiceState.java │ │ ├── ServiceThread.java │ │ ├── SystemClock.java │ │ ├── ThreadFactoryImpl.java │ │ ├── TopicConfig.java │ │ ├── TopicFilterType.java │ │ ├── UtilAll.java │ │ ├── admin │ │ ├── ConsumeStats.java │ │ ├── OffsetWrapper.java │ │ ├── RollbackStats.java │ │ ├── TopicOffset.java │ │ └── TopicStatsTable.java │ │ ├── annotation │ │ └── ImportantField.java │ │ ├── conflict │ │ └── PackageConflictDetect.java │ │ ├── constant │ │ ├── DBMsgConstants.java │ │ ├── LoggerName.java │ │ └── PermName.java │ │ ├── consumer │ │ └── ConsumeFromWhere.java │ │ ├── filter │ │ ├── FilterAPI.java │ │ ├── FilterContext.java │ │ ├── MessageFilter.java │ │ └── impl │ │ │ ├── Op.java │ │ │ ├── Operand.java │ │ │ ├── Operator.java │ │ │ ├── PolishExpr.java │ │ │ └── Type.java │ │ ├── help │ │ └── FAQUrl.java │ │ ├── hook │ │ └── FilterCheckHook.java │ │ ├── message │ │ ├── Message.java │ │ ├── MessageAccessor.java │ │ ├── MessageClientExt.java │ │ ├── MessageClientIDSetter.java │ │ ├── MessageConst.java │ │ ├── MessageDecoder.java │ │ ├── MessageExt.java │ │ ├── MessageId.java │ │ ├── MessageQueue.java │ │ ├── MessageQueueForC.java │ │ └── MessageType.java │ │ ├── namesrv │ │ ├── NamesrvConfig.java │ │ ├── NamesrvUtil.java │ │ ├── RegisterBrokerResult.java │ │ └── TopAddressing.java │ │ ├── protocol │ │ ├── MQProtosHelper.java │ │ ├── RequestCode.java │ │ ├── ResponseCode.java │ │ ├── body │ │ │ ├── BrokerStatsData.java │ │ │ ├── BrokerStatsItem.java │ │ │ ├── CMResult.java │ │ │ ├── ClusterInfo.java │ │ │ ├── Connection.java │ │ │ ├── ConsumeByWho.java │ │ │ ├── ConsumeMessageDirectlyResult.java │ │ │ ├── ConsumeStatsList.java │ │ │ ├── ConsumeStatus.java │ │ │ ├── ConsumerConnection.java │ │ │ ├── ConsumerOffsetSerializeWrapper.java │ │ │ ├── ConsumerRunningInfo.java │ │ │ ├── GetConsumerStatusBody.java │ │ │ ├── GroupList.java │ │ │ ├── KVTable.java │ │ │ ├── LockBatchRequestBody.java │ │ │ ├── LockBatchResponseBody.java │ │ │ ├── ProcessQueueInfo.java │ │ │ ├── ProducerConnection.java │ │ │ ├── QueryConsumeTimeSpanBody.java │ │ │ ├── QueryCorrectionOffsetBody.java │ │ │ ├── QueueTimeSpan.java │ │ │ ├── RegisterBrokerBody.java │ │ │ ├── ResetOffsetBody.java │ │ │ ├── ResetOffsetBodyForC.java │ │ │ ├── SubscriptionGroupWrapper.java │ │ │ ├── TopicConfigSerializeWrapper.java │ │ │ ├── TopicList.java │ │ │ └── UnlockBatchRequestBody.java │ │ ├── header │ │ │ ├── CheckTransactionStateRequestHeader.java │ │ │ ├── CheckTransactionStateResponseHeader.java │ │ │ ├── CloneGroupOffsetRequestHeader.java │ │ │ ├── ConsumeMessageDirectlyResultRequestHeader.java │ │ │ ├── ConsumerSendMsgBackRequestHeader.java │ │ │ ├── CreateTopicRequestHeader.java │ │ │ ├── DeleteSubscriptionGroupRequestHeader.java │ │ │ ├── DeleteTopicRequestHeader.java │ │ │ ├── EndTransactionRequestHeader.java │ │ │ ├── EndTransactionResponseHeader.java │ │ │ ├── GetAllTopicConfigResponseHeader.java │ │ │ ├── GetBrokerConfigResponseHeader.java │ │ │ ├── GetConsumeStatsInBrokerHeader.java │ │ │ ├── GetConsumeStatsRequestHeader.java │ │ │ ├── GetConsumerConnectionListRequestHeader.java │ │ │ ├── GetConsumerListByGroupRequestHeader.java │ │ │ ├── GetConsumerListByGroupResponseBody.java │ │ │ ├── GetConsumerListByGroupResponseHeader.java │ │ │ ├── GetConsumerRunningInfoRequestHeader.java │ │ │ ├── GetConsumerStatusRequestHeader.java │ │ │ ├── GetEarliestMsgStoretimeRequestHeader.java │ │ │ ├── GetEarliestMsgStoretimeResponseHeader.java │ │ │ ├── GetMaxOffsetRequestHeader.java │ │ │ ├── GetMaxOffsetResponseHeader.java │ │ │ ├── GetMinOffsetRequestHeader.java │ │ │ ├── GetMinOffsetResponseHeader.java │ │ │ ├── GetProducerConnectionListRequestHeader.java │ │ │ ├── GetTopicStatsInfoRequestHeader.java │ │ │ ├── GetTopicsByClusterRequestHeader.java │ │ │ ├── NotifyConsumerIdsChangedRequestHeader.java │ │ │ ├── PullMessageRequestHeader.java │ │ │ ├── PullMessageResponseHeader.java │ │ │ ├── QueryConsumeTimeSpanRequestHeader.java │ │ │ ├── QueryConsumerOffsetRequestHeader.java │ │ │ ├── QueryConsumerOffsetResponseHeader.java │ │ │ ├── QueryCorrectionOffsetHeader.java │ │ │ ├── QueryMessageRequestHeader.java │ │ │ ├── QueryMessageResponseHeader.java │ │ │ ├── QueryTopicConsumeByWhoRequestHeader.java │ │ │ ├── ResetOffsetRequestHeader.java │ │ │ ├── SearchOffsetRequestHeader.java │ │ │ ├── SearchOffsetResponseHeader.java │ │ │ ├── SendMessageRequestHeader.java │ │ │ ├── SendMessageRequestHeaderV2.java │ │ │ ├── SendMessageResponseHeader.java │ │ │ ├── UnregisterClientRequestHeader.java │ │ │ ├── UnregisterClientResponseHeader.java │ │ │ ├── UpdateConsumerOffsetRequestHeader.java │ │ │ ├── UpdateConsumerOffsetResponseHeader.java │ │ │ ├── ViewBrokerStatsDataRequestHeader.java │ │ │ ├── ViewMessageRequestHeader.java │ │ │ ├── ViewMessageResponseHeader.java │ │ │ ├── filtersrv │ │ │ │ ├── RegisterFilterServerRequestHeader.java │ │ │ │ ├── RegisterFilterServerResponseHeader.java │ │ │ │ └── RegisterMessageFilterClassRequestHeader.java │ │ │ └── namesrv │ │ │ │ ├── DeleteKVConfigRequestHeader.java │ │ │ │ ├── DeleteTopicInNamesrvRequestHeader.java │ │ │ │ ├── GetKVConfigRequestHeader.java │ │ │ │ ├── GetKVConfigResponseHeader.java │ │ │ │ ├── GetKVListByNamespaceRequestHeader.java │ │ │ │ ├── GetRouteInfoRequestHeader.java │ │ │ │ ├── GetRouteInfoResponseHeader.java │ │ │ │ ├── PutKVConfigRequestHeader.java │ │ │ │ ├── RegisterBrokerRequestHeader.java │ │ │ │ ├── RegisterBrokerResponseHeader.java │ │ │ │ ├── RegisterOrderTopicRequestHeader.java │ │ │ │ ├── UnRegisterBrokerRequestHeader.java │ │ │ │ ├── WipeWritePermOfBrokerRequestHeader.java │ │ │ │ └── WipeWritePermOfBrokerResponseHeader.java │ │ ├── heartbeat │ │ │ ├── ConsumeType.java │ │ │ ├── ConsumerData.java │ │ │ ├── HeartbeatData.java │ │ │ ├── MessageModel.java │ │ │ ├── ProducerData.java │ │ │ └── SubscriptionData.java │ │ ├── route │ │ │ ├── BrokerData.java │ │ │ ├── QueueData.java │ │ │ └── TopicRouteData.java │ │ └── topic │ │ │ └── OffsetMovedEvent.java │ │ ├── queue │ │ ├── ConcurrentTreeMap.java │ │ └── RoundQueue.java │ │ ├── running │ │ └── RunningStats.java │ │ ├── stats │ │ ├── MomentStatsItem.java │ │ ├── MomentStatsItemSet.java │ │ ├── StatsItem.java │ │ ├── StatsItemSet.java │ │ └── StatsSnapshot.java │ │ ├── subscription │ │ └── SubscriptionGroupConfig.java │ │ ├── sysflag │ │ ├── MessageSysFlag.java │ │ ├── PullSysFlag.java │ │ ├── SubscriptionSysFlag.java │ │ └── TopicSysFlag.java │ │ └── utils │ │ ├── ChannelUtil.java │ │ ├── HttpTinyClient.java │ │ └── IOTinyUtils.java │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── common │ ├── MixAllTest.java │ ├── RemotingUtilTest.java │ ├── UtilAllTest.java │ ├── filter │ ├── FilterAPITest.java │ └── PolishExprTest.java │ └── protocol │ ├── ConsumeStatusTest.java │ └── MQProtosHelperTest.java ├── rocketmq-console ├── LICENSE ├── README.md ├── eclipse.bat ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ ├── action │ │ ├── AbstractAction.java │ │ ├── BrokerAction.java │ │ ├── ClusterAction.java │ │ ├── ConnectionAction.java │ │ ├── ConsumerAction.java │ │ ├── MessageAction.java │ │ ├── NamesrvAction.java │ │ ├── OffsetAction.java │ │ ├── TopicAction.java │ │ └── admin │ │ │ └── ConfigureAction.java │ │ ├── common │ │ ├── Table.java │ │ └── Tool.java │ │ ├── config │ │ └── ConfigureInitializer.java │ │ ├── service │ │ ├── AbstractService.java │ │ ├── BrokerService.java │ │ ├── ClusterService.java │ │ ├── ConnectionService.java │ │ ├── ConsumerService.java │ │ ├── MessageService.java │ │ ├── NamesrvService.java │ │ ├── OffsetService.java │ │ └── TopicService.java │ │ └── validate │ │ ├── CmdTrace.java │ │ └── CmdValidator.java │ ├── resources │ ├── config.properties │ ├── logback.xml │ └── spring │ │ └── applicationContext.xml │ └── webapp │ ├── WEB-INF │ ├── index.html │ ├── springmvc-servlet.xml │ ├── velocity-toolbox.xml │ ├── vm │ │ ├── broker │ │ │ ├── brokerStats.vm │ │ │ └── updateBrokerConfig.vm │ │ ├── cluster │ │ │ ├── demo.vm │ │ │ └── list.vm │ │ ├── connection │ │ │ ├── consumerConnection.vm │ │ │ └── producerConnection.vm │ │ ├── consumer │ │ │ ├── consumerProgress.vm │ │ │ ├── deleteSubGroup.vm │ │ │ └── updateSubGroup.vm │ │ ├── foot.vm │ │ ├── head.vm │ │ ├── index.vm │ │ ├── js.vm │ │ ├── macro.vm │ │ ├── message │ │ │ ├── queryMsgById.vm │ │ │ ├── queryMsgByKey.vm │ │ │ └── queryMsgByOffset.vm │ │ ├── msg.vm │ │ ├── namesrv │ │ │ ├── deleteKvConfig.vm │ │ │ ├── deleteProjectGroup.vm │ │ │ ├── getProjectGroup.vm │ │ │ ├── updateKvConfig.vm │ │ │ ├── updateProjectGroup.vm │ │ │ └── wipeWritePerm.vm │ │ ├── navbar.vm │ │ ├── offset │ │ │ └── resetOffsetByTime.vm │ │ ├── template-bak.vm │ │ ├── template.vm │ │ └── topic │ │ │ ├── add.vm │ │ │ ├── delete.vm │ │ │ ├── list.vm │ │ │ ├── route.vm │ │ │ ├── stats.vm │ │ │ └── update.vm │ └── web.xml │ ├── css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ └── theme.css │ ├── index.html │ └── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── docs.min.js │ ├── holder.js │ └── jquery-1.10.2.min.js ├── rocketmq-example ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ └── example │ │ ├── README.md │ │ ├── benchmark │ │ ├── Consumer.java │ │ ├── Producer.java │ │ └── TransactionProducer.java │ │ ├── broadcast │ │ └── PushConsumer.java │ │ ├── filter │ │ ├── Consumer.java │ │ ├── MessageFilterImpl.java │ │ └── Producer.java │ │ ├── operation │ │ ├── Consumer.java │ │ └── Producer.java │ │ ├── ordermessage │ │ ├── Consumer.java │ │ └── Producer.java │ │ ├── quickstart │ │ ├── Consumer.java │ │ └── Producer.java │ │ ├── simple │ │ ├── AsyncProducer.java │ │ ├── CachedQueue.java │ │ ├── Producer.java │ │ ├── PullConsumer.java │ │ ├── PullConsumerTest.java │ │ ├── PullScheduleService.java │ │ ├── PushConsumer.java │ │ ├── RandomAsyncCommit.java │ │ └── TestProducer.java │ │ └── transaction │ │ ├── TransactionCheckListenerImpl.java │ │ ├── TransactionExecuterImpl.java │ │ └── TransactionProducer.java │ └── resources │ └── MessageFilterImpl.java ├── rocketmq-filtersrv ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── filtersrv │ ├── FilterServerOuterAPI.java │ ├── FiltersrvConfig.java │ ├── FiltersrvController.java │ ├── FiltersrvStartup.java │ ├── filter │ ├── DynaCode.java │ ├── FilterClassFetchMethod.java │ ├── FilterClassInfo.java │ ├── FilterClassLoader.java │ ├── FilterClassManager.java │ └── HttpFilterClassFetchMethod.java │ ├── processor │ └── DefaultRequestProcessor.java │ └── stats │ └── FilterServerStatsManager.java ├── rocketmq-namesrv ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── namesrv │ ├── NamesrvController.java │ ├── NamesrvStartup.java │ ├── kvconfig │ ├── KVConfigManager.java │ └── KVConfigSerializeWrapper.java │ ├── processor │ ├── ClusterTestRequestProcessor.java │ └── DefaultRequestProcessor.java │ └── routeinfo │ ├── BrokerHousekeepingService.java │ └── RouteInfoManager.java ├── rocketmq-remoting ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ └── remoting │ │ ├── ChannelEventListener.java │ │ ├── CommandCustomHeader.java │ │ ├── InvokeCallback.java │ │ ├── RPCHook.java │ │ ├── RemotingClient.java │ │ ├── RemotingServer.java │ │ ├── RemotingService.java │ │ ├── annotation │ │ ├── CFNotNull.java │ │ └── CFNullable.java │ │ ├── common │ │ ├── Pair.java │ │ ├── RemotingHelper.java │ │ ├── RemotingUtil.java │ │ ├── SemaphoreReleaseOnlyOnce.java │ │ └── ServiceThread.java │ │ ├── exception │ │ ├── RemotingCommandException.java │ │ ├── RemotingConnectException.java │ │ ├── RemotingException.java │ │ ├── RemotingSendRequestException.java │ │ ├── RemotingTimeoutException.java │ │ └── RemotingTooMuchRequestException.java │ │ ├── netty │ │ ├── NettyClientConfig.java │ │ ├── NettyDecoder.java │ │ ├── NettyEncoder.java │ │ ├── NettyEvent.java │ │ ├── NettyEventType.java │ │ ├── NettyRemotingAbstract.java │ │ ├── NettyRemotingClient.java │ │ ├── NettyRemotingServer.java │ │ ├── NettyRequestProcessor.java │ │ ├── NettyServerConfig.java │ │ ├── NettySystemConfig.java │ │ ├── RequestTask.java │ │ └── ResponseFuture.java │ │ └── protocol │ │ ├── LanguageCode.java │ │ ├── RemotingCommand.java │ │ ├── RemotingCommandType.java │ │ ├── RemotingSerializable.java │ │ ├── RemotingSysResponseCode.java │ │ ├── RocketMQSerializable.java │ │ ├── SerializeType.java │ │ ├── protocol.sevialize.txt │ │ └── protocol.txt │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ ├── remoting │ ├── ExceptionTest.java │ ├── MixTest.java │ ├── NettyConnectionTest.java │ ├── NettyIdleTest.java │ ├── NettyRPCTest.java │ └── SyncInvokeTest.java │ └── subclass │ └── TestSubClassAuto.java ├── rocketmq-srvutil ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ └── srvutil │ │ └── ServerUtil.java │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── srvutil │ └── ServerUtilTest.java ├── rocketmq-store ├── pom.xml ├── sbin │ ├── map.sh │ ├── put.sh │ ├── response.sh │ ├── showcpu.sh │ ├── showdirty.sh │ ├── showdirty2.sh │ ├── showiostat.sh │ ├── showload.sh │ ├── showmap.sh │ ├── showmaptotal.sh │ ├── showvmstat.sh │ └── test.sh └── src │ ├── main │ └── java │ │ └── com │ │ └── alibaba │ │ └── rocketmq │ │ └── store │ │ ├── AllocateMapedFileService.java │ │ ├── AppendMessageCallback.java │ │ ├── AppendMessageResult.java │ │ ├── AppendMessageStatus.java │ │ ├── CommitLog.java │ │ ├── ConsumeQueue.java │ │ ├── DefaultMessageFilter.java │ │ ├── DefaultMessageStore.java │ │ ├── DispatchRequest.java │ │ ├── GetMessageResult.java │ │ ├── GetMessageStatus.java │ │ ├── MapedFile.java │ │ ├── MapedFileQueue.java │ │ ├── MessageArrivingListener.java │ │ ├── MessageExtBrokerInner.java │ │ ├── MessageFilter.java │ │ ├── MessageStore.java │ │ ├── PutMessageResult.java │ │ ├── PutMessageStatus.java │ │ ├── QueryMessageResult.java │ │ ├── ReferenceResource.java │ │ ├── RunningFlags.java │ │ ├── SelectMapedBufferResult.java │ │ ├── StoreCheckpoint.java │ │ ├── StoreStatsService.java │ │ ├── StoreUtil.java │ │ ├── config │ │ ├── BrokerRole.java │ │ ├── FlushDiskType.java │ │ ├── MessageStoreConfig.java │ │ └── StorePathConfigHelper.java │ │ ├── ha │ │ ├── HAConnection.java │ │ ├── HAService.java │ │ └── WaitNotifyObject.java │ │ ├── index │ │ ├── IndexFile.java │ │ ├── IndexHeader.java │ │ ├── IndexService.java │ │ └── QueryOffsetResult.java │ │ ├── schedule │ │ ├── DelayOffsetSerializeWrapper.java │ │ └── ScheduleMessageService.java │ │ ├── stats │ │ ├── BrokerStats.java │ │ └── BrokerStatsManager.java │ │ ├── transaction │ │ ├── TransactionCheckExecuter.java │ │ └── TransactionStateService.java │ │ └── util │ │ └── LibC.java │ └── test │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── store │ ├── DefaultMessageStoreTest.java │ ├── MapedFileQueueTest.java │ ├── MapedFileTest.java │ ├── RecoverTest.java │ ├── StoreCheckpointTest.java │ ├── index │ └── IndexFileTest.java │ └── schedule │ └── ScheduleMessageTest.java ├── rocketmq-tools ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── alibaba │ └── rocketmq │ └── tools │ ├── admin │ ├── DefaultMQAdminExt.java │ ├── DefaultMQAdminExtImpl.java │ ├── MQAdminExt.java │ └── api │ │ ├── MessageTrack.java │ │ └── TrackType.java │ ├── command │ ├── CommandUtil.java │ ├── MQAdminStartup.java │ ├── SubCommand.java │ ├── broker │ │ ├── BrokerConsumeStatsSubCommad.java │ │ ├── BrokerStatusSubCommand.java │ │ ├── CleanExpiredCQSubCommand.java │ │ ├── CleanUnusedTopicCommand.java │ │ ├── SendMsgStatusCommand.java │ │ └── UpdateBrokerConfigSubCommand.java │ ├── cluster │ │ ├── CLusterSendMsgRTCommand.java │ │ └── ClusterListSubCommand.java │ ├── connection │ │ ├── ConsumerConnectionSubCommand.java │ │ └── ProducerConnectionSubCommand.java │ ├── consumer │ │ ├── ConsumerProgressSubCommand.java │ │ ├── ConsumerStatusSubCommand.java │ │ ├── ConsumerSubCommand.java │ │ ├── DeleteSubscriptionGroupCommand.java │ │ ├── StartMonitoringSubCommand.java │ │ └── UpdateSubGroupSubCommand.java │ ├── message │ │ ├── CheckMsgSendRTCommand.java │ │ ├── CheckMsgSubCommand.java │ │ ├── DecodeMessageIdCommond.java │ │ ├── PrintMessageSubCommand.java │ │ ├── QueryMsgByIdSubCommand.java │ │ ├── QueryMsgByKeySubCommand.java │ │ ├── QueryMsgByOffsetSubCommand.java │ │ ├── QueryMsgByUniqueKeySubCommand.java │ │ └── Store.java │ ├── namesrv │ │ ├── DeleteKvConfigCommand.java │ │ ├── UpdateKvConfigCommand.java │ │ └── WipeWritePermSubCommand.java │ ├── offset │ │ ├── CloneGroupOffsetCommand.java │ │ ├── GetConsumerStatusCommand.java │ │ ├── ResetOffsetByTimeCommand.java │ │ └── ResetOffsetByTimeOldCommand.java │ ├── stats │ │ └── StatsAllSubCommand.java │ └── topic │ │ ├── AllocateMQSubCommand.java │ │ ├── DeleteTopicSubCommand.java │ │ ├── RebalanceResult.java │ │ ├── TopicClusterSubCommand.java │ │ ├── TopicListSubCommand.java │ │ ├── TopicRouteSubCommand.java │ │ ├── TopicStatusSubCommand.java │ │ ├── UpdateOrderConfCommand.java │ │ ├── UpdateTopicPermSubCommand.java │ │ └── UpdateTopicSubCommand.java │ ├── github │ └── SyncDocsToGithubSubCommand.java │ └── monitor │ ├── DefaultMonitorListener.java │ ├── DeleteMsgsEvent.java │ ├── FailedMsgs.java │ ├── MonitorConfig.java │ ├── MonitorListener.java │ ├── MonitorService.java │ └── UndoneMsgs.java └── test ├── consumer.sh ├── producer.sh └── runclass.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings/ 4 | target/ 5 | *.log* 6 | *.iml 7 | .idea/ 8 | *.versionsBackup 9 | *.DS_Store 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## MyRocketMQ -- 源于阿里巴巴消息中间件——RocketMQ,修正了一些bug,添加了完整的事务消息支持。 2 | 3 | 4 | ---------- 5 | ## License 6 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) Copyright (C) 2010-2013 Alibaba Group Holding Limited 7 | -------------------------------------------------------------------------------- /benchmark/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.benchmark.Consumer $@ & 7 | -------------------------------------------------------------------------------- /benchmark/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 -Dcom.alibaba.rocketmq.client.sendSmartMsg=true com.alibaba.rocketmq.example.benchmark.Producer $@ & 7 | -------------------------------------------------------------------------------- /benchmark/runclass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # $Id: runserver.sh 1831 2013-05-16 01:39:51Z 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="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=320m" 17 | JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC" 18 | JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${HOME}/rmq_srv_gc.log -XX:+PrintGCDetails" 19 | JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" 20 | JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib" 21 | #JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" 22 | JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" 23 | 24 | if [ -z "$JAVA_HOME" ]; then 25 | JAVA_HOME=/opt/taobao/java 26 | fi 27 | 28 | JAVA="$JAVA_HOME/bin/java" 29 | 30 | $JAVA ${JAVA_OPT} $@ 31 | -------------------------------------------------------------------------------- /benchmark/tproducer.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.benchmark.TransactionProducer $@ 7 | -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | ### 操作系统调优 2 | 在生产环境部署Broker前,必须要执行os.sh,对操作系统进行调优 3 | 4 | **P.S: os.sh只能执行一次,需要sudo root权限** 5 | 6 | ### 启动broker 7 | * Unix平台 8 | 9 | `nohup sh mqbroker &` 10 | 11 | * Windows平台(仅支持64位) 12 | 13 | `mqbroker.exe` 14 | 15 | ### 关闭broker 16 | sh mqshutdown broker 17 | 18 | ### 启动Name Server 19 | * Unix平台 20 | 21 | `nohup sh mqnamesrv &` 22 | 23 | * Windows平台(仅支持64位) 24 | 25 | `mqnamesrv.exe` 26 | 27 | ### 关闭Name Server 28 | sh mqshutdown namesrv 29 | 30 | ### 更新或创建Topic 31 | sh mqadmin updateTopic -b 127.0.0.1:10911 -t TopicA 32 | 33 | ### 更新或创建订阅组 34 | sh mqadmin updateSubGroup -b 127.0.0.1:10911 -g SubGroupA -------------------------------------------------------------------------------- /bin/cleancache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | export PATH=$PATH:/sbin 19 | 20 | sysctl -w vm.drop_caches=3 21 | -------------------------------------------------------------------------------- /bin/cleancache.v1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | export PATH=$PATH:/sbin 19 | 20 | # 21 | # GB 22 | # 23 | function changeFreeCache() 24 | { 25 | EXTRA=$1 26 | MIN=$2 27 | sysctl -w vm.extra_free_kbytes=${EXTRA}000000 28 | sysctl -w vm.min_free_kbytes=${MIN}000000 29 | } 30 | 31 | 32 | if [ $# -ne 1 ] 33 | then 34 | echo "Usage: $0 freecache(GB)" 35 | echo "Example: $0 15" 36 | exit 37 | fi 38 | 39 | changeFreeCache 3 $1 40 | changeFreeCache 3 1 41 | -------------------------------------------------------------------------------- /bin/mqadmin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | sh ${ROCKETMQ_HOME}/bin/tools.sh com.alibaba.rocketmq.tools.command.MQAdminStartup $@ 46 | -------------------------------------------------------------------------------- /bin/mqadmin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YunaiV/MyRocketMQ/f023392819407ff30d2c60b1b721852fbf22634a/bin/mqadmin.exe -------------------------------------------------------------------------------- /bin/mqadmin.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | false 20 | 21 | ${JAVA_HOME} 22 | 23 | server 24 | 25 | com.alibaba.rocketmq.tools.command.MQAdminStartup 26 | 27 | 28 | ${cpd}/../lib 29 | ${cpd}/.. 30 | 31 | 32 | 33 | 34 | 35 | 36 | <-Xms512m> 37 | <-Xmx1g> 38 | <-XX:NewSize>256M 39 | <-XX:MaxNewSize>512M 40 | <-XX:PermSize>128M 41 | <-XX:MaxPermSize>128M 42 | 43 | 44 | -------------------------------------------------------------------------------- /bin/mqbroker.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YunaiV/MyRocketMQ/f023392819407ff30d2c60b1b721852fbf22634a/bin/mqbroker.exe -------------------------------------------------------------------------------- /bin/mqbroker.numanode0: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | export RMQ_NUMA_NODE=0 46 | 47 | sh ${ROCKETMQ_HOME}/bin/mqbroker $@ 48 | -------------------------------------------------------------------------------- /bin/mqbroker.numanode1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | export RMQ_NUMA_NODE=1 46 | 47 | sh ${ROCKETMQ_HOME}/bin/mqbroker $@ 48 | -------------------------------------------------------------------------------- /bin/mqbroker.numanode2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | export RMQ_NUMA_NODE=2 46 | 47 | sh ${ROCKETMQ_HOME}/bin/mqbroker $@ 48 | -------------------------------------------------------------------------------- /bin/mqbroker.numanode3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | export RMQ_NUMA_NODE=3 46 | 47 | sh ${ROCKETMQ_HOME}/bin/mqbroker $@ 48 | -------------------------------------------------------------------------------- /bin/mqbroker.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | false 20 | 21 | ${JAVA_HOME} 22 | 23 | server 24 | 25 | com.alibaba.rocketmq.broker.BrokerStartup 26 | 27 | 28 | ${cpd}/../lib 29 | ${cpd}/.. 30 | 31 | 32 | 33 | 34 | 35 | 36 | <-Xms512m> 37 | <-Xmx1g> 38 | <-XX:NewSize>256M 39 | <-XX:MaxNewSize>512M 40 | <-XX:PermSize>128M 41 | <-XX:MaxPermSize>128M 42 | 43 | 44 | -------------------------------------------------------------------------------- /bin/mqfiltersrv: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.filtersrv.FiltersrvStartup $@ 46 | -------------------------------------------------------------------------------- /bin/mqfiltersrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YunaiV/MyRocketMQ/f023392819407ff30d2c60b1b721852fbf22634a/bin/mqfiltersrv.exe -------------------------------------------------------------------------------- /bin/mqfiltersrv.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | false 20 | 21 | ${JAVA_HOME} 22 | 23 | server 24 | 25 | com.alibaba.rocketmq.filtersrv.FiltersrvStartup 26 | 27 | 28 | ${cpd}/../lib 29 | ${cpd}/.. 30 | 31 | 32 | 33 | 34 | 35 | 36 | <-Xms512m> 37 | <-Xmx1g> 38 | <-XX:NewSize>256M 39 | <-XX:MaxNewSize>512M 40 | <-XX:PermSize>128M 41 | <-XX:MaxPermSize>128M 42 | 43 | 44 | -------------------------------------------------------------------------------- /bin/mqnamesrv: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.namesrv.NamesrvStartup $@ 46 | -------------------------------------------------------------------------------- /bin/mqnamesrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YunaiV/MyRocketMQ/f023392819407ff30d2c60b1b721852fbf22634a/bin/mqnamesrv.exe -------------------------------------------------------------------------------- /bin/mqnamesrv.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | false 20 | 21 | ${JAVA_HOME} 22 | 23 | server 24 | 25 | com.alibaba.rocketmq.namesrv.NamesrvStartup 26 | 27 | 28 | ${cpd}/../lib 29 | ${cpd}/.. 30 | 31 | 32 | 33 | 34 | 35 | 36 | <-Xms512m> 37 | <-Xmx1g> 38 | <-XX:NewSize>256M 39 | <-XX:MaxNewSize>512M 40 | <-XX:PermSize>128M 41 | <-XX:MaxPermSize>128M 42 | 43 | 44 | -------------------------------------------------------------------------------- /bin/play.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | # 19 | # Name Server 20 | # 21 | nohup sh mqnamesrv > ns.log 2>&1 & 22 | 23 | # 24 | # Service Addr 25 | # 26 | ADDR=`hostname -i`:9876 27 | 28 | # 29 | # Broker 30 | # 31 | nohup sh mqbroker -n ${ADDR} > bk.log 2>&1 & 32 | 33 | echo "Start Name Server and Broker Successfully, ${ADDR}" 34 | -------------------------------------------------------------------------------- /bin/setcache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | export PATH=$PATH:/sbin 19 | 20 | # 21 | # GB 22 | # 23 | function changeFreeCache() 24 | { 25 | EXTRA=$1 26 | MIN=$2 27 | sysctl -w vm.extra_free_kbytes=${EXTRA}000000 28 | sysctl -w vm.min_free_kbytes=${MIN}000000 29 | sysctl -w vm.swappiness=0 30 | } 31 | 32 | 33 | if [ $# -ne 2 ] 34 | then 35 | echo "Usage: $0 extra_free_kbytes(GB) min_free_kbytes(GB)" 36 | echo "Example: $0 3 1" 37 | exit 38 | fi 39 | 40 | changeFreeCache $1 $2 41 | -------------------------------------------------------------------------------- /bin/startfsrv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | if [ -z "$ROCKETMQ_HOME" ] ; then 19 | ## resolve links - $0 may be a link to maven's home 20 | PRG="$0" 21 | 22 | # need this for relative symlinks 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG="`dirname "$PRG"`/$link" 30 | fi 31 | done 32 | 33 | saveddir=`pwd` 34 | 35 | ROCKETMQ_HOME=`dirname "$PRG"`/.. 36 | 37 | # make it fully qualified 38 | ROCKETMQ_HOME=`cd "$ROCKETMQ_HOME" && pwd` 39 | 40 | cd "$saveddir" 41 | fi 42 | 43 | export ROCKETMQ_HOME 44 | 45 | nohup sh ${ROCKETMQ_HOME}/bin/runserver.sh com.alibaba.rocketmq.filtersrv.FiltersrvStartup $@ & 46 | -------------------------------------------------------------------------------- /conf/2m-2s-async/broker-a-s.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-a 18 | brokerId=1 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SLAVE 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-async/broker-a.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-a 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=ASYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-async/broker-b-s.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-b 18 | brokerId=1 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SLAVE 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-async/broker-b.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-b 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=ASYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-sync/broker-a-s.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-a 18 | brokerId=1 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SLAVE 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-sync/broker-a.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-a 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-sync/broker-b-s.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-b 18 | brokerId=1 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SLAVE 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-2s-sync/broker-b.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-b 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=SYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-noslave/broker-a.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-a 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=ASYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /conf/2m-noslave/broker-b.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | brokerClusterName=DefaultCluster 17 | brokerName=broker-b 18 | brokerId=0 19 | deleteWhen=04 20 | fileReservedTime=48 21 | brokerRole=ASYNC_MASTER 22 | flushDiskType=ASYNC_FLUSH 23 | -------------------------------------------------------------------------------- /deploy.bat: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | mvn -Dmaven.test.skip=true deploy -------------------------------------------------------------------------------- /eclipse.bat: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | mvn -U eclipse:eclipse 17 | -------------------------------------------------------------------------------- /install.bat: -------------------------------------------------------------------------------- 1 | REM Licensed to the Apache Software Foundation (ASF) under one or more 2 | REM contributor license agreements. See the NOTICE file distributed with 3 | REM this work for additional information regarding copyright ownership. 4 | REM The ASF licenses this file to You under the Apache License, Version 2.0 5 | REM (the "License"); you may not use this file except in compliance with 6 | REM the License. You may obtain a copy of the License at 7 | REM 8 | REM http://www.apache.org/licenses/LICENSE-2.0 9 | REM 10 | REM Unless required by applicable law or agreed to in writing, software 11 | REM distributed under the License is distributed on an "AS IS" BASIS, 12 | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | REM See the License for the specific language governing permissions and 14 | REM limitations under the License. 15 | 16 | mvn -Dmaven.test.skip=true clean package install assembly:assembly -U 17 | 18 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | git pull 19 | 20 | rm -rf target 21 | rm -f devenv 22 | if [ -z "$JAVA_HOME" ]; then 23 | JAVA_HOME=/opt/taobao/java 24 | fi 25 | export PATH=/opt/taobao/mvn/bin:$JAVA_HOME/bin:$PATH 26 | mvn -Dmaven.test.skip=true clean package install assembly:assembly -U 27 | 28 | ln -s target/alibaba-rocketmq-broker/alibaba-rocketmq devenv 29 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/client/ConsumerIdsChangeListener.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.broker.client; 18 | 19 | import io.netty.channel.Channel; 20 | 21 | import java.util.List; 22 | 23 | 24 | /** 25 | * @author shijia.wxr 26 | */ 27 | public interface ConsumerIdsChangeListener { 28 | public void consumerIdsChanged(final String group, final List channels); 29 | } 30 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/latency/FutureTaskExt.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.broker.latency; 19 | 20 | import java.util.concurrent.Callable; 21 | import java.util.concurrent.FutureTask; 22 | 23 | /** 24 | * @author shijia.wxr 25 | */ 26 | public class FutureTaskExt extends FutureTask { 27 | private final Runnable runnable; 28 | 29 | public FutureTaskExt(final Callable callable) { 30 | super(callable); 31 | this.runnable = null; 32 | } 33 | 34 | public FutureTaskExt(final Runnable runnable, final V result) { 35 | super(runnable, result); 36 | this.runnable = runnable; 37 | } 38 | 39 | public Runnable getRunnable() { 40 | return runnable; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/mqtrace/ConsumeMessageHook.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.broker.mqtrace; 18 | 19 | public interface ConsumeMessageHook { 20 | String hookName(); 21 | 22 | 23 | void consumeMessageBefore(final ConsumeMessageContext context); 24 | 25 | 26 | void consumeMessageAfter(final ConsumeMessageContext context); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/mqtrace/SendMessageHook.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.broker.mqtrace; 18 | 19 | public interface SendMessageHook { 20 | public String hookName(); 21 | 22 | 23 | public void sendMessageBefore(final SendMessageContext context); 24 | 25 | 26 | public void sendMessageAfter(final SendMessageContext context); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/transaction/TransactionRecord.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.broker.transaction; 19 | 20 | public class TransactionRecord { 21 | // Commit Log Offset 22 | private long offset; 23 | private String producerGroup; 24 | 25 | 26 | public long getOffset() { 27 | return offset; 28 | } 29 | 30 | 31 | public void setOffset(long offset) { 32 | this.offset = offset; 33 | } 34 | 35 | 36 | public String getProducerGroup() { 37 | return producerGroup; 38 | } 39 | 40 | 41 | public void setProducerGroup(String producerGroup) { 42 | this.producerGroup = producerGroup; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/java/com/alibaba/rocketmq/broker/transaction/TransactionStore.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.broker.transaction; 19 | 20 | import java.util.List; 21 | 22 | 23 | public interface TransactionStore { 24 | public boolean open(); 25 | 26 | 27 | public void close(); 28 | 29 | 30 | public boolean put(final List trs); 31 | 32 | 33 | public void remove(final List pks); 34 | 35 | 36 | public List traverse(final long pk, final int nums); 37 | 38 | 39 | public long totalRecords(); 40 | 41 | 42 | public long minPK(); 43 | 44 | 45 | public long maxPK(); 46 | } 47 | -------------------------------------------------------------------------------- /rocketmq-broker/src/main/resources/transaction.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE t_transaction( 2 | offset NUMERIC(20) PRIMARY KEY, 3 | producerGroup VARCHAR(64) 4 | ) 5 | -------------------------------------------------------------------------------- /rocketmq-client/deploy.bat: -------------------------------------------------------------------------------- 1 | mvn -Dmaven.test.skip=true deploy -Pclient-shade -------------------------------------------------------------------------------- /rocketmq-client/install.bat: -------------------------------------------------------------------------------- 1 | mvn -Dmaven.test.skip=true clean package install -Pclient-shade -U 2 | 3 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/admin/MQAdminExtInner.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.client.admin; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public interface MQAdminExtInner { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/common/ClientErrorCode.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.client.common; 19 | 20 | public class ClientErrorCode { 21 | public static final int ConnectBrokerException = 10001; 22 | public static final int AccessBrokerTimeout = 10002; 23 | public static final int BrokerNotExistException = 10003; 24 | public static final int NoNameServerException = 10004; 25 | public static final int NotFoundTopicException = 10005; 26 | } -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/PullCallback.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.client.consumer; 18 | 19 | /** 20 | * Async message pulling interface 21 | * 22 | * @author shijia.wxr 23 | */ 24 | public interface PullCallback { 25 | public void onSuccess(final PullResult pullResult); 26 | 27 | public void onException(final Throwable e); 28 | } 29 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/PullStatus.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.client.consumer; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum PullStatus { 23 | /** 24 | * Founded 25 | */ 26 | FOUND, 27 | /** 28 | * No new message can be pull 29 | */ 30 | NO_NEW_MSG, 31 | /** 32 | * Filtering results can not match 33 | */ 34 | NO_MATCHED_MSG, 35 | /** 36 | * Illegal offset,may be too big or too small 37 | */ 38 | OFFSET_ILLEGAL 39 | } 40 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/PullTaskCallback.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.client.consumer; 18 | 19 | import com.alibaba.rocketmq.common.message.MessageQueue; 20 | 21 | 22 | public interface PullTaskCallback { 23 | public void doPullTask(final MessageQueue mq, final PullTaskContext context); 24 | } 25 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/listener/ConsumeConcurrentlyStatus.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.client.consumer.listener; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum ConsumeConcurrentlyStatus { 23 | /** 24 | * Success consumption 25 | */ 26 | CONSUME_SUCCESS, 27 | /** 28 | * Failure consumption,later try to consume 29 | */ 30 | RECONSUME_LATER; 31 | } 32 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/listener/ConsumeOrderlyStatus.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.client.consumer.listener; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum ConsumeOrderlyStatus { 23 | /** 24 | * Success consumption 25 | */ 26 | SUCCESS, 27 | /** 28 | * Rollback consumption(only for binlog consumption) 29 | */ 30 | @Deprecated 31 | ROLLBACK, 32 | /** 33 | * Commit offset(only for binlog consumption) 34 | */ 35 | @Deprecated 36 | COMMIT, 37 | /** 38 | * Suspend current queue a moment 39 | */ 40 | SUSPEND_CURRENT_QUEUE_A_MOMENT; 41 | } 42 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/listener/MessageListener.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.client.consumer.listener; 18 | 19 | /** 20 | * A MessageListener object is used to receive asynchronously delivered messages. 21 | * 22 | * @author shijia.wxr 23 | */ 24 | public interface MessageListener { 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/consumer/store/ReadOffsetType.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.client.consumer.store; 18 | 19 | public enum ReadOffsetType { 20 | /** 21 | * From memory 22 | */ 23 | READ_FROM_MEMORY, 24 | /** 25 | * From storage 26 | */ 27 | READ_FROM_STORE, 28 | /** 29 | * From memory,then from storage 30 | */ 31 | MEMORY_FIRST_THEN_STORE; 32 | } 33 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/hook/CheckForbiddenHook.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.client.hook; 19 | 20 | import com.alibaba.rocketmq.client.exception.MQClientException; 21 | 22 | 23 | /** 24 | * @author: manhong.yqd 25 | */ 26 | public interface CheckForbiddenHook { 27 | public String hookName(); 28 | 29 | 30 | public void checkForbidden(final CheckForbiddenContext context) throws MQClientException; 31 | } 32 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/hook/ConsumeMessageHook.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.client.hook; 18 | 19 | public interface ConsumeMessageHook { 20 | String hookName(); 21 | 22 | void consumeMessageBefore(final ConsumeMessageContext context); 23 | 24 | void consumeMessageAfter(final ConsumeMessageContext context); 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/hook/FilterMessageHook.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.client.hook; 18 | 19 | /** 20 | * @author manhong.yqd 21 | */ 22 | public interface FilterMessageHook { 23 | public String hookName(); 24 | 25 | 26 | public void filterMessage(final FilterMessageContext context); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/hook/SendMessageHook.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.client.hook; 18 | 19 | public interface SendMessageHook { 20 | String hookName(); 21 | 22 | void sendMessageBefore(final SendMessageContext context); 23 | 24 | void sendMessageAfter(final SendMessageContext context); 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/impl/CommunicationMode.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.client.impl; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum CommunicationMode { 23 | SYNC, 24 | ASYNC, 25 | ONEWAY, 26 | } 27 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/impl/FindBrokerResult.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.client.impl; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public class FindBrokerResult { 23 | private final String brokerAddr; 24 | private final boolean slave; 25 | 26 | 27 | public FindBrokerResult(String brokerAddr, boolean slave) { 28 | this.brokerAddr = brokerAddr; 29 | this.slave = slave; 30 | } 31 | 32 | 33 | public String getBrokerAddr() { 34 | return brokerAddr; 35 | } 36 | 37 | 38 | public boolean isSlave() { 39 | return slave; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/latency/LatencyFaultTolerance.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.client.latency; 19 | 20 | /** 21 | * @author shijia.wxr 22 | */ 23 | public interface LatencyFaultTolerance { 24 | void updateFaultItem(final T name, final long currentLatency, final long notAvailableDuration); 25 | 26 | boolean isAvailable(final T name); 27 | 28 | void remove(final T name); 29 | 30 | T pickOneAtLeast(); 31 | } 32 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/LocalTransactionExecuter.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.client.producer; 18 | 19 | import com.alibaba.rocketmq.common.message.Message; 20 | 21 | 22 | /** 23 | * @author shijia.wxr 24 | */ 25 | public interface LocalTransactionExecuter { 26 | public LocalTransactionState executeLocalTransactionBranch(final Message msg, final Object arg); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/LocalTransactionState.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.client.producer; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum LocalTransactionState { 23 | COMMIT_MESSAGE, 24 | ROLLBACK_MESSAGE, 25 | UNKNOW, 26 | } 27 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/MessageQueueSelector.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.client.producer; 18 | 19 | import com.alibaba.rocketmq.common.message.Message; 20 | import com.alibaba.rocketmq.common.message.MessageQueue; 21 | 22 | import java.util.List; 23 | 24 | 25 | /** 26 | * @author shijia.wxr 27 | */ 28 | public interface MessageQueueSelector { 29 | MessageQueue select(final List mqs, final Message msg, final Object arg); 30 | } 31 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/SendCallback.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.client.producer; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public interface SendCallback { 23 | public void onSuccess(final SendResult sendResult); 24 | 25 | 26 | public void onException(final Throwable e); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/SendStatus.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.client.producer; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum SendStatus { 23 | SEND_OK, 24 | FLUSH_DISK_TIMEOUT, 25 | FLUSH_SLAVE_TIMEOUT, 26 | SLAVE_NOT_AVAILABLE, 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/TransactionCheckListener.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.client.producer; 18 | 19 | import com.alibaba.rocketmq.common.message.MessageExt; 20 | 21 | 22 | /** 23 | * @author shijia.wxr 24 | */ 25 | public interface TransactionCheckListener { 26 | LocalTransactionState checkLocalTransactionState(final MessageExt msg); 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/producer/TransactionSendResult.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.client.producer; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public class TransactionSendResult extends SendResult { 23 | private LocalTransactionState localTransactionState; 24 | 25 | 26 | public TransactionSendResult() { 27 | } 28 | 29 | 30 | public LocalTransactionState getLocalTransactionState() { 31 | return localTransactionState; 32 | } 33 | 34 | 35 | public void setLocalTransactionState(LocalTransactionState localTransactionState) { 36 | this.localTransactionState = localTransactionState; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /rocketmq-client/src/test/java/com/alibaba/rocketmq/client/ValidatorsTest.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.client; 19 | 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | 23 | 24 | public class ValidatorsTest { 25 | 26 | @Test 27 | public void topicValidatorTest() { 28 | try { 29 | Validators.checkTopic("Hello"); 30 | Validators.checkTopic("%RETRY%Hello"); 31 | Validators.checkTopic("_%RETRY%Hello"); 32 | Validators.checkTopic("-%RETRY%Hello"); 33 | Validators.checkTopic("223-%RETRY%Hello"); 34 | } catch (Exception e) { 35 | e.printStackTrace(); 36 | Assert.assertTrue(false); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/Pair.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.common; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public class Pair { 23 | private T1 object1; 24 | private T2 object2; 25 | 26 | 27 | public Pair(T1 object1, T2 object2) { 28 | this.object1 = object1; 29 | this.object2 = object2; 30 | } 31 | 32 | 33 | public T1 getObject1() { 34 | return object1; 35 | } 36 | 37 | 38 | public void setObject1(T1 object1) { 39 | this.object1 = object1; 40 | } 41 | 42 | 43 | public T2 getObject2() { 44 | return object2; 45 | } 46 | 47 | 48 | public void setObject2(T2 object2) { 49 | this.object2 = object2; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/ServiceState.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.common; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum ServiceState { 23 | /** 24 | * Service just created,not start 25 | */ 26 | CREATE_JUST, 27 | /** 28 | * Service Running 29 | */ 30 | RUNNING, 31 | /** 32 | * Service shutdown 33 | */ 34 | SHUTDOWN_ALREADY, 35 | /** 36 | * Service Start failure 37 | */ 38 | START_FAILED; 39 | } 40 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/ThreadFactoryImpl.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.common; 19 | 20 | import java.util.concurrent.ThreadFactory; 21 | import java.util.concurrent.atomic.AtomicLong; 22 | 23 | 24 | public class ThreadFactoryImpl implements ThreadFactory { 25 | private final AtomicLong threadIndex = new AtomicLong(0); 26 | private final String threadNamePrefix; 27 | 28 | 29 | public ThreadFactoryImpl(final String threadNamePrefix) { 30 | this.threadNamePrefix = threadNamePrefix; 31 | } 32 | 33 | 34 | @Override 35 | public Thread newThread(Runnable r) { 36 | return new Thread(r, threadNamePrefix + this.threadIndex.incrementAndGet()); 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/TopicFilterType.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.common; 18 | 19 | /** 20 | * @author shijia.wxr 21 | */ 22 | public enum TopicFilterType { 23 | SINGLE_TAG, 24 | MULTI_TAG 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/annotation/ImportantField.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.common.annotation; 18 | 19 | import java.lang.annotation.*; 20 | 21 | 22 | @Documented 23 | @Retention(RetentionPolicy.RUNTIME) 24 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE}) 25 | public @interface ImportantField { 26 | } 27 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/constant/DBMsgConstants.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.common.constant; 19 | 20 | public class DBMsgConstants { 21 | public static final int maxBodySize = 64 * 1024 * 1204; //64KB 22 | } 23 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/consumer/ConsumeFromWhere.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.common.consumer; 18 | 19 | /** 20 | * 21 | * @author shijia.wxr 22 | */ 23 | public enum ConsumeFromWhere { 24 | CONSUME_FROM_LAST_OFFSET, 25 | 26 | @Deprecated 27 | CONSUME_FROM_LAST_OFFSET_AND_FROM_MIN_WHEN_BOOT_FIRST, 28 | @Deprecated 29 | CONSUME_FROM_MIN_OFFSET, 30 | @Deprecated 31 | CONSUME_FROM_MAX_OFFSET, 32 | CONSUME_FROM_FIRST_OFFSET, 33 | CONSUME_FROM_TIMESTAMP, 34 | } 35 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/filter/FilterContext.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.common.filter; 19 | 20 | public class FilterContext { 21 | private String consumerGroup; 22 | 23 | 24 | public String getConsumerGroup() { 25 | return consumerGroup; 26 | } 27 | 28 | 29 | public void setConsumerGroup(String consumerGroup) { 30 | this.consumerGroup = consumerGroup; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/filter/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 | 18 | package com.alibaba.rocketmq.common.filter; 19 | 20 | import com.alibaba.rocketmq.common.message.MessageExt; 21 | 22 | 23 | public interface MessageFilter { 24 | boolean match(final MessageExt msg, final FilterContext context); 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/filter/impl/Op.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.common.filter.impl; 19 | 20 | public abstract class Op { 21 | 22 | private String symbol; 23 | 24 | 25 | protected Op(String symbol) { 26 | this.symbol = symbol; 27 | } 28 | 29 | 30 | public String getSymbol() { 31 | return symbol; 32 | } 33 | 34 | 35 | public String toString() { 36 | return symbol; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/filter/impl/Operand.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.common.filter.impl; 19 | 20 | public class Operand extends Op { 21 | 22 | public Operand(String symbol) { 23 | super(symbol); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/filter/impl/Type.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.common.filter.impl; 19 | 20 | public enum Type { 21 | NULL, 22 | OPERAND, 23 | OPERATOR, 24 | PARENTHESIS, 25 | SEPAERATOR; 26 | } 27 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/hook/FilterCheckHook.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.common.hook; 19 | 20 | import java.nio.ByteBuffer; 21 | 22 | 23 | /** 24 | * 25 | * @author manhong.yqd 26 | * 27 | */ 28 | public interface FilterCheckHook { 29 | public String hookName(); 30 | 31 | 32 | public boolean isFilterMatched(final boolean isUnitMode, final ByteBuffer byteBuffer); 33 | } 34 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/message/MessageType.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.common.message; 19 | 20 | public enum MessageType { 21 | Normal_Msg, 22 | Trans_Msg_Half, 23 | Trans_msg_Commit, 24 | Delay_Msg, 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/namesrv/NamesrvUtil.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.common.namesrv; 19 | 20 | /** 21 | * @author shijia.wxr 22 | */ 23 | public class NamesrvUtil { 24 | public static final String NAMESPACE_ORDER_TOPIC_CONFIG = "ORDER_TOPIC_CONFIG"; 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/CMResult.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.common.protocol.body; 19 | 20 | public enum CMResult { 21 | CR_SUCCESS, 22 | CR_LATER, 23 | CR_ROLLBACK, 24 | CR_COMMIT, 25 | CR_THROW_EXCEPTION, 26 | CR_RETURN_NULL, 27 | } 28 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/GroupList.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.common.protocol.body; 18 | 19 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 20 | 21 | import java.util.HashSet; 22 | 23 | 24 | /** 25 | * @author shijia.wxr 26 | * 27 | */ 28 | public class GroupList extends RemotingSerializable { 29 | private HashSet groupList = new HashSet(); 30 | 31 | 32 | public HashSet getGroupList() { 33 | return groupList; 34 | } 35 | 36 | 37 | public void setGroupList(HashSet groupList) { 38 | this.groupList = groupList; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/KVTable.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.common.protocol.body; 18 | 19 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 20 | 21 | import java.util.HashMap; 22 | 23 | 24 | /** 25 | * @author shijia.wxr 26 | * 27 | */ 28 | public class KVTable extends RemotingSerializable { 29 | private HashMap table = new HashMap(); 30 | 31 | 32 | public HashMap getTable() { 33 | return table; 34 | } 35 | 36 | 37 | public void setTable(HashMap table) { 38 | this.table = table; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/ProducerConnection.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.common.protocol.body; 19 | 20 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 21 | 22 | import java.util.HashSet; 23 | 24 | 25 | /** 26 | * @author shijia.wxr 27 | */ 28 | public class ProducerConnection extends RemotingSerializable { 29 | private HashSet connectionSet = new HashSet(); 30 | 31 | 32 | public HashSet getConnectionSet() { 33 | return connectionSet; 34 | } 35 | 36 | 37 | public void setConnectionSet(HashSet connectionSet) { 38 | this.connectionSet = connectionSet; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/ResetOffsetBody.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.common.protocol.body; 19 | 20 | import com.alibaba.rocketmq.common.message.MessageQueue; 21 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 22 | 23 | import java.util.Map; 24 | 25 | 26 | /** 27 | * @author manhong.yqd 28 | * 29 | */ 30 | public class ResetOffsetBody extends RemotingSerializable { 31 | private Map offsetTable; 32 | 33 | 34 | public Map getOffsetTable() { 35 | return offsetTable; 36 | } 37 | 38 | 39 | public void setOffsetTable(Map offsetTable) { 40 | this.offsetTable = offsetTable; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/ResetOffsetBodyForC.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.common.protocol.body; 19 | 20 | import com.alibaba.rocketmq.common.message.MessageQueueForC; 21 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 22 | 23 | import java.util.List; 24 | 25 | public class ResetOffsetBodyForC extends RemotingSerializable { 26 | 27 | private List offsetTable; 28 | 29 | 30 | public List getOffsetTable() { 31 | return offsetTable; 32 | } 33 | 34 | 35 | public void setOffsetTable(List offsetTable) { 36 | this.offsetTable = offsetTable; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/EndTransactionResponseHeader.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 | * $Id: EndTransactionResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.header; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class EndTransactionResponseHeader implements CommandCustomHeader { 31 | 32 | @Override 33 | public void checkFields() throws RemotingCommandException { 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/GetAllTopicConfigResponseHeader.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 | * $Id: GetAllTopicConfigResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.header; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class GetAllTopicConfigResponseHeader implements CommandCustomHeader { 31 | 32 | @Override 33 | public void checkFields() throws RemotingCommandException { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/GetConsumerListByGroupResponseBody.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.common.protocol.header; 19 | 20 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 21 | 22 | import java.util.List; 23 | 24 | 25 | /** 26 | * @author shijia.wxr 27 | */ 28 | public class GetConsumerListByGroupResponseBody extends RemotingSerializable { 29 | private List consumerIdList; 30 | 31 | 32 | public List getConsumerIdList() { 33 | return consumerIdList; 34 | } 35 | 36 | 37 | public void setConsumerIdList(List consumerIdList) { 38 | this.consumerIdList = consumerIdList; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/GetConsumerListByGroupResponseHeader.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.common.protocol.header; 19 | 20 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 21 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 22 | 23 | 24 | /** 25 | * @author shijia.wxr 26 | */ 27 | public class GetConsumerListByGroupResponseHeader implements CommandCustomHeader { 28 | 29 | @Override 30 | public void checkFields() throws RemotingCommandException { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/UnregisterClientResponseHeader.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.common.protocol.header; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class UnregisterClientResponseHeader implements CommandCustomHeader { 31 | 32 | @Override 33 | public void checkFields() throws RemotingCommandException { 34 | // TODO Auto-generated method stub 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/UpdateConsumerOffsetResponseHeader.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 | * $Id: UpdateConsumerOffsetResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.header; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class UpdateConsumerOffsetResponseHeader implements CommandCustomHeader { 31 | @Override 32 | public void checkFields() throws RemotingCommandException { 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/ViewMessageResponseHeader.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 | * $Id: ViewMessageResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.header; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class ViewMessageResponseHeader implements CommandCustomHeader { 31 | 32 | @Override 33 | public void checkFields() throws RemotingCommandException { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/header/namesrv/GetRouteInfoResponseHeader.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 | * $Id: GetRouteInfoResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.header.namesrv; 22 | 23 | import com.alibaba.rocketmq.remoting.CommandCustomHeader; 24 | import com.alibaba.rocketmq.remoting.exception.RemotingCommandException; 25 | 26 | 27 | /** 28 | * @author shijia.wxr 29 | */ 30 | public class GetRouteInfoResponseHeader implements CommandCustomHeader { 31 | 32 | @Override 33 | public void checkFields() throws RemotingCommandException { 34 | // TODO Auto-generated method stub 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/heartbeat/ConsumeType.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 | * $Id: ConsumeType.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.heartbeat; 22 | 23 | /** 24 | * @author shijia.wxr 25 | */ 26 | public enum ConsumeType { 27 | 28 | CONSUME_ACTIVELY("PULL"), 29 | 30 | CONSUME_PASSIVELY("PUSH"); 31 | 32 | private String typeCN; 33 | 34 | ConsumeType(String typeCN) { 35 | this.typeCN = typeCN; 36 | } 37 | 38 | 39 | public String getTypeCN() { 40 | return typeCN; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/heartbeat/MessageModel.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 | * $Id: MessageModel.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.heartbeat; 22 | 23 | /** 24 | * Message model 25 | * 26 | * @author shijia.wxr 27 | */ 28 | public enum MessageModel { 29 | /** 30 | * broadcast 31 | */ 32 | BROADCASTING("BROADCASTING"), 33 | /** 34 | * clustering 35 | */ 36 | CLUSTERING("CLUSTERING"); 37 | 38 | private String modeCN; 39 | 40 | MessageModel(String modeCN) { 41 | this.modeCN = modeCN; 42 | } 43 | 44 | 45 | public String getModeCN() { 46 | return modeCN; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/heartbeat/ProducerData.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 | * $Id: ProducerData.java 1835 2013-05-16 02:00:50Z shijia.wxr $ 20 | */ 21 | package com.alibaba.rocketmq.common.protocol.heartbeat; 22 | 23 | /** 24 | * @author shijia.wxr 25 | */ 26 | public class ProducerData { 27 | private String groupName; 28 | 29 | 30 | public String getGroupName() { 31 | return groupName; 32 | } 33 | 34 | 35 | public void setGroupName(String groupName) { 36 | this.groupName = groupName; 37 | } 38 | 39 | 40 | @Override 41 | public String toString() { 42 | return "ProducerData [groupName=" + groupName + "]"; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/running/RunningStats.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.common.running; 18 | 19 | public enum RunningStats { 20 | commitLogMaxOffset, 21 | commitLogMinOffset, 22 | commitLogDiskRatio, 23 | consumeQueueDiskRatio, 24 | scheduleMessageOffset, 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-common/src/main/java/com/alibaba/rocketmq/common/utils/ChannelUtil.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.common.utils; 19 | 20 | import io.netty.channel.Channel; 21 | 22 | import java.net.InetAddress; 23 | import java.net.InetSocketAddress; 24 | 25 | public class ChannelUtil { 26 | public static String getRemoteIp(Channel channel) { 27 | InetSocketAddress inetSocketAddress = (InetSocketAddress) channel.remoteAddress(); 28 | if (inetSocketAddress == null) { 29 | return ""; 30 | } 31 | final InetAddress inetAddr = inetSocketAddress.getAddress(); 32 | return (inetAddr != null ? inetAddr.getHostAddress() : inetSocketAddress.getHostName()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /rocketmq-common/src/test/java/com/alibaba/rocketmq/common/MixAllTest.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.common; 19 | 20 | import junit.framework.Assert; 21 | import org.junit.Test; 22 | 23 | import java.net.InetAddress; 24 | import java.util.List; 25 | 26 | 27 | /** 28 | * @author lansheng.zj 29 | */ 30 | public class MixAllTest { 31 | 32 | @Test 33 | public void test() throws Exception { 34 | List localInetAddress = MixAll.getLocalInetAddress(); 35 | String local = InetAddress.getLocalHost().getHostAddress(); 36 | Assert.assertTrue(localInetAddress.contains("127.0.0.1")); 37 | Assert.assertTrue(localInetAddress.contains(local)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /rocketmq-common/src/test/java/com/alibaba/rocketmq/common/RemotingUtilTest.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.common; 18 | 19 | import com.alibaba.rocketmq.remoting.common.RemotingUtil; 20 | import org.junit.Test; 21 | 22 | 23 | public class RemotingUtilTest { 24 | @Test 25 | public void test() throws Exception { 26 | String a = RemotingUtil.getLocalAddress(); 27 | System.out.println(a); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rocketmq-common/src/test/java/com/alibaba/rocketmq/common/protocol/ConsumeStatusTest.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.common.protocol; 19 | 20 | import com.alibaba.rocketmq.common.protocol.body.ConsumeStatus; 21 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 22 | import org.junit.Test; 23 | 24 | 25 | public class ConsumeStatusTest { 26 | 27 | @Test 28 | public void decode_test() throws Exception { 29 | ConsumeStatus cs = new ConsumeStatus(); 30 | cs.setConsumeFailedTPS(0L); 31 | String json = RemotingSerializable.toJson(cs, true); 32 | System.out.println(json); 33 | RemotingSerializable.fromJson(json, ConsumeStatus.class); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /rocketmq-common/src/test/java/com/alibaba/rocketmq/common/protocol/MQProtosHelperTest.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.common.protocol; 19 | 20 | /** 21 | * @author shijia.wxr 22 | */ 23 | public class MQProtosHelperTest { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /rocketmq-console/README.md: -------------------------------------------------------------------------------- 1 | RocketMQ Console 2 | ================ 3 | 4 | 为RocketMQ提供web控制台 5 | 6 | 7 | Note 8 | ================ 9 | 10 | This fork is compatible with [RocketMQ](http://github.com/alibaba/rocketmq) __3.2.6__ 11 | -------------------------------------------------------------------------------- /rocketmq-console/eclipse.bat: -------------------------------------------------------------------------------- 1 | mvn -U eclipse:eclipse 2 | 3 | pause 4 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/java/com/alibaba/rocketmq/action/admin/ConfigureAction.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.rocketmq.action.admin; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * 管理员操作,实时更新配置 8 | * @author yankai913@gmail.com 9 | * @date 2014-2-13 10 | */ 11 | @Controller 12 | @RequestMapping("/admin") 13 | public class ConfigureAction { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/java/com/alibaba/rocketmq/common/Tool.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.rocketmq.common; 2 | 3 | /** 4 | * 5 | * @author yankai913@gmail.com 6 | * @date 2014-2-18 7 | */ 8 | public class Tool { 9 | 10 | public static String str(int n) { 11 | return String.valueOf(n); 12 | } 13 | 14 | 15 | public static String str(long n) { 16 | return String.valueOf(n); 17 | } 18 | 19 | 20 | public static String str(double n) { 21 | return String.valueOf(n); 22 | } 23 | 24 | 25 | public static boolean bool(String str) { 26 | return Boolean.valueOf(str); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/java/com/alibaba/rocketmq/config/ConfigureInitializer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.rocketmq.config; 2 | 3 | 4 | import com.alibaba.rocketmq.common.MixAll; 5 | 6 | 7 | /** 8 | * 把需要补充的初始化环境变量正式的放入系统属性中 9 | * 10 | * @author yankai913@gmail.com 11 | * @date 2014-2-10 12 | * 13 | */ 14 | public class ConfigureInitializer { 15 | 16 | private String namesrvAddr; 17 | 18 | public String getNamesrvAddr() { 19 | return namesrvAddr; 20 | } 21 | 22 | public void setNamesrvAddr(String namesrvAddr) { 23 | this.namesrvAddr = namesrvAddr; 24 | } 25 | 26 | public void init() { 27 | System.setProperty(MixAll.NAMESRV_ADDR_PROPERTY, namesrvAddr); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/java/com/alibaba/rocketmq/validate/CmdTrace.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.rocketmq.validate; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import com.alibaba.rocketmq.tools.command.SubCommand; 9 | 10 | 11 | /** 12 | * 13 | * @author yankai913@gmail.com 14 | * @date 2014-2-25 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target(ElementType.METHOD) 18 | public @interface CmdTrace { 19 | Class cmdClazz(); 20 | } 21 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | rocketmq.namesrv.addr=127.0.0.1:9876 2 | throwDone=true 3 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{yyyy-MM-dd HH:mm:ss,GMT+8} %-5p [%t] - %m%n 6 | 7 | 8 | 9 | 10 | 12 | ${user.home}/logs/consolelogs/rocketmq-console.log 13 | true 14 | 15 | ${user.home}/logs/consolelogs/rocketmq-console-%d{yyyy-MM-dd}.%i.log 16 | 17 | 19 | 104857600 20 | 21 | 10 22 | 23 | 24 | %d{yyyy-MM-dd HH:mm:ss,GMT+8} %-5p [%t] - %m%n 25 | 26 | UTF-8 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/resources/spring/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/velocity-toolbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | date 5 | application 6 | org.apache.velocity.tools.generic.DateTool 7 | 8 | 9 | escape 10 | application 11 | org.apache.velocity.tools.generic.EscapeTool 12 | 13 | 14 | math 15 | application 16 | org.apache.velocity.tools.generic.MathTool 17 | 18 | 19 | link 20 | request 21 | org.apache.velocity.tools.view.tools.LinkTool 22 | 23 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/broker/brokerStats.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) 3 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/broker/updateBrokerConfig.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/cluster/list.vm: -------------------------------------------------------------------------------- 1 | #table($table) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/connection/producerConnection.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #if($pc) 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | #foreach($conn in $pc.connectionSet) 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | #end 24 | 25 |
idClientIdClientAddrLanguageVersion
$!{velocityCount}$conn.clientId$conn.ClientAddr$conn.language$conn.version
26 |
27 | #end 28 | 29 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/consumer/consumerProgress.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/consumer/deleteSubGroup.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/consumer/updateSubGroup.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/foot.vm: -------------------------------------------------------------------------------- 1 |

Powered by Bootstrap, 2 | Velocity, 3 | Spring etc.

-------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/head.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | $title 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/index.vm: -------------------------------------------------------------------------------- 1 | $helloWord 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/js.vm: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/message/queryMsgById.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) 3 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/message/queryMsgByKey.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/message/queryMsgByOffset.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/msg.vm: -------------------------------------------------------------------------------- 1 | #if($alertMsg) 2 |
3 | $!alertMsg 4 |
5 | #elseif($alertTrue) 6 |
7 | Well done! 8 |
9 | #end 10 | 11 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/deleteKvConfig.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/deleteProjectGroup.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/getProjectGroup.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 |

$!resultText

3 | 4 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/updateKvConfig.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/updateProjectGroup.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/namesrv/wipeWritePerm.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | #table($table) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/offset/resetOffsetByTime.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/template-bak.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #parse("head.vm") 5 | 6 | 7 | #parse("navbar.vm") 8 | #parse("msg.vm") 9 |
10 | #table($table) 11 | #parse("foot.vm") 12 |
13 | #parse("js.vm") 14 | 15 | 16 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/template.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #set($root=$link.getContextPath()) 5 | #parse("head.vm") 6 | 7 | 8 | #parse("navbar.vm") 9 |
10 | #parse("msg.vm") 11 | 12 | #parse($bodyPage) 13 | 14 | #parse("foot.vm") 15 |
16 | #parse("js.vm") 17 | 18 | 19 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/topic/add.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/topic/delete.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) 2 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/topic/stats.vm: -------------------------------------------------------------------------------- 1 | #table($table) 2 | 3 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/vm/topic/update.vm: -------------------------------------------------------------------------------- 1 | #form($options $action) -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | rocketmq-console 8 | 9 | 10 | contextConfigLocation 11 | 12 | classpath:spring/applicationContext.xml 13 | 14 | 15 | 16 | 17 | org.springframework.web.context.ContextLoaderListener 18 | 19 | 20 | 21 | springmvc 22 | org.springframework.web.servlet.DispatcherServlet 23 | 1 24 | 25 | 26 | 27 | springmvc 28 | *.do 29 | 30 | 31 | 32 | /WEB-INF/index.html 33 | /index.html 34 | 35 | 36 | -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/css/theme.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 70px; 3 | padding-bottom: 30px; 4 | } 5 | 6 | .theme-dropdown .dropdown-menu { 7 | display: block; 8 | position: static; 9 | margin-bottom: 20px; 10 | } 11 | 12 | .theme-showcase > p > .btn { 13 | margin: 5px 0; 14 | } -------------------------------------------------------------------------------- /rocketmq-console/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rocketmq-example/src/main/java/com/alibaba/rocketmq/example/README.md: -------------------------------------------------------------------------------- 1 | ### 发送非顺序消息 2 | ### 发送顺序消息 3 | ### 发送事务消息 4 | ### 订阅非顺序消息 5 | ### 订阅顺序消息 6 | ### 主动Pull消息 7 | ### 广播方式订阅消息 8 | -------------------------------------------------------------------------------- /rocketmq-example/src/main/java/com/alibaba/rocketmq/example/simple/CachedQueue.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.example.simple; 19 | 20 | import com.alibaba.rocketmq.common.message.MessageExt; 21 | 22 | import java.util.TreeMap; 23 | 24 | 25 | public class CachedQueue { 26 | private final TreeMap msgCachedTable = new TreeMap(); 27 | 28 | 29 | public TreeMap getMsgCachedTable() { 30 | return msgCachedTable; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rocketmq-example/src/main/resources/MessageFilterImpl.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.rocketmq.example.filter; 2 | 3 | import com.alibaba.rocketmq.common.filter.FilterContext; 4 | import com.alibaba.rocketmq.common.filter.MessageFilter; 5 | import com.alibaba.rocketmq.common.message.MessageExt; 6 | 7 | 8 | public class MessageFilterImpl implements MessageFilter { 9 | 10 | @Override 11 | public boolean match(MessageExt msg, FilterContext context) { 12 | String property = msg.getUserProperty("SequenceId"); 13 | if (property != null) { 14 | int id = Integer.parseInt(property); 15 | if ((id % 3) == 0 && (id > 10)) { 16 | return true; 17 | } 18 | } 19 | 20 | return false; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rocketmq-filtersrv/src/main/java/com/alibaba/rocketmq/filtersrv/filter/FilterClassFetchMethod.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.filtersrv.filter; 19 | 20 | public interface FilterClassFetchMethod { 21 | public String fetch(final String topic, final String consumerGroup, final String className); 22 | } 23 | -------------------------------------------------------------------------------- /rocketmq-filtersrv/src/main/java/com/alibaba/rocketmq/filtersrv/filter/FilterClassLoader.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.filtersrv.filter; 19 | 20 | public class FilterClassLoader extends ClassLoader { 21 | public final Class createNewClass(String name, byte[] b, int off, int len) throws ClassFormatError { 22 | return this.defineClass(name, b, off, len); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rocketmq-namesrv/src/main/java/com/alibaba/rocketmq/namesrv/kvconfig/KVConfigSerializeWrapper.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.namesrv.kvconfig; 18 | 19 | import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; 20 | 21 | import java.util.HashMap; 22 | 23 | 24 | /** 25 | * @author shijia.wxr 26 | */ 27 | public class KVConfigSerializeWrapper extends RemotingSerializable { 28 | private HashMap> configTable; 29 | 30 | 31 | public HashMap> getConfigTable() { 32 | return configTable; 33 | } 34 | 35 | 36 | public void setConfigTable(HashMap> 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 | --------------------------------------------------------------------------------