org.apache.rocketmq.common.ServiceState Java Examples
The following examples show how to use
org.apache.rocketmq.common.ServiceState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPullConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPullConsumer.getConsumerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #2
Source File: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.consumeMessageService.shutdown(); this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPushConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPushConsumer.getConsumerGroup()); this.rebalanceImpl.destroy(); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #3
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPullConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPullConsumer.getConsumerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #4
Source File: DefaultMQAdminExtImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mqClientInstance.unregisterAdminExt(this.defaultMQAdminExt.getAdminExtGroup()); this.mqClientInstance.shutdown(); log.info("the adminExt [{}] shutdown OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #5
Source File: DefaultMQProducerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public void shutdown(final boolean shutdownFactory) { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: // 取消注册生产者=》 this.mQClientFactory.unregisterProducer(this.defaultMQProducer.getProducerGroup()); if (shutdownFactory) { this.mQClientFactory.shutdown(); } log.info("the producer [{}] shutdown OK", this.defaultMQProducer.getProducerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #6
Source File: DefaultMQPushConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: // 消费消息服务关闭=》 this.consumeMessageService.shutdown(); // 持久化消费者offset=》 this.persistConsumerOffset(); // 消费者取消注册=》 this.mQClientFactory.unregisterConsumer(this.defaultMQPushConsumer.getConsumerGroup()); // 消费者服务关闭=》 this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPushConsumer.getConsumerGroup()); // 处理队列销毁=》 this.rebalanceImpl.destroy(); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #7
Source File: DefaultMQPullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: // 持久化消费者offset=》 this.persistConsumerOffset(); // 取消注册=》 this.mQClientFactory.unregisterConsumer(this.defaultMQPullConsumer.getConsumerGroup()); // mqclient关闭=》 this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPullConsumer.getConsumerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #8
Source File: DefaultMQAdminExtImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Override public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mqClientInstance.unregisterAdminExt(this.defaultMQAdminExt.getAdminExtGroup()); this.mqClientInstance.shutdown(); log.info("the adminExt [{}] shutdown OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #9
Source File: DeFiBusProducerImpl.java From DeFiBus with Apache License 2.0 | 6 votes |
private void updateClusterInfo() { try { MQClientInstance mqClientInstance = this.deFiBusProducer.getDefaultMQProducer().getDefaultMQProducerImpl().getmQClientFactory(); if (mqClientInstance != null && this.deFiBusProducer.getDefaultMQProducer().getDefaultMQProducerImpl().getServiceState() == ServiceState.RUNNING) { if (mqClientInstance.getMQClientAPIImpl() != null && mqClientInstance.getMQClientAPIImpl().getNameServerAddressList() != null && mqClientInstance.getMQClientAPIImpl().getNameServerAddressList().size() == 0) { mqClientInstance.getMQClientAPIImpl().fetchNameServerAddr(); } clusterInfo = mqClientInstance.getMQClientAPIImpl().getBrokerClusterInfo(3000); updateLocalBrokers(clusterInfo); } } catch (Throwable e) { LOGGER.warn("updateClusterInfo failed, {}", e.getMessage()); } }
Example #10
Source File: DefaultMQPullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
/** * shutdown */ public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPullConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPullConsumer.getConsumerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #11
Source File: DefaultMQAdminExtImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Override public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mqClientInstance.unregisterAdminExt(this.defaultMQAdminExt.getAdminExtGroup()); this.mqClientInstance.shutdown(); log.info("the adminExt [{}] shutdown OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #12
Source File: DefaultMQPushConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.consumeMessageService.shutdown(); this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPushConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPushConsumer.getConsumerGroup()); this.rebalanceImpl.destroy(); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #13
Source File: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPullConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPullConsumer.getConsumerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #14
Source File: DefaultMQAdminExtImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mqClientInstance.unregisterAdminExt(this.defaultMQAdminExt.getAdminExtGroup()); this.mqClientInstance.shutdown(); log.info("the adminExt [{}] shutdown OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #15
Source File: DefaultMQAdminExtImpl.java From rocketmq with Apache License 2.0 | 6 votes |
@Override public void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mqClientInstance.unregisterAdminExt(this.defaultMQAdminExt.getAdminExtGroup()); this.mqClientInstance.shutdown(); log.info("the adminExt [{}] shutdown OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #16
Source File: DefaultMQPushConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
/** * shotdown时,持久化消费偏移量 */ public synchronized void shutdown() { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.consumeMessageService.shutdown(); //持久化消费偏移量 this.persistConsumerOffset(); this.mQClientFactory.unregisterConsumer(this.defaultMQPushConsumer.getConsumerGroup()); this.mQClientFactory.shutdown(); log.info("the consumer [{}] shutdown OK", this.defaultMQPushConsumer.getConsumerGroup()); this.rebalanceImpl.destroy(); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #17
Source File: DefaultMQProducerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
public void shutdown(final boolean shutdownFactory) { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mQClientFactory.unregisterProducer(this.defaultMQProducer.getProducerGroup()); if (shutdownFactory) { this.mQClientFactory.shutdown(); } log.info("the producer [{}] shutdown OK", this.defaultMQProducer.getProducerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #18
Source File: DefaultMQProducerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
public void shutdown(final boolean shutdownFactory) { switch (this.serviceState) { case CREATE_JUST: break; case RUNNING: this.mQClientFactory.unregisterProducer(this.defaultMQProducer.getProducerGroup()); if (shutdownFactory) { this.mQClientFactory.shutdown(); } log.info("the producer [{}] shutdown OK", this.defaultMQProducer.getProducerGroup()); this.serviceState = ServiceState.SHUTDOWN_ALREADY; break; case SHUTDOWN_ALREADY: break; default: break; } }
Example #19
Source File: DefaultMQPushConsumerImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 确保状态ok * @throws MQClientException ; */ private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #20
Source File: DefaultMQPullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 确保服务是正常的 * @throws MQClientException ; */ private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #21
Source File: DefaultMQPushConsumerImpl.java From rocketmq with Apache License 2.0 | 5 votes |
/** * 校验Consumer是否处于运行{@link ServiceState#RUNNING}状态。 * * @throws MQClientException 当不处于运行状态抛出client异常 */ private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, "// + this.serviceState// + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #22
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #23
Source File: MQClientInstance.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 启动MqClientInstance * @throws MQClientException ; */ public void start() throws MQClientException { synchronized (this) { switch (this.serviceState) { case CREATE_JUST: this.serviceState = ServiceState.START_FAILED; // If not specified,looking address from name server if (null == this.clientConfig.getNamesrvAddr()) { this.mQClientAPIImpl.fetchNameServerAddr(); } // Start request-response channel this.mQClientAPIImpl.start(); // Start various schedule tasks this.startScheduledTask(); // Start pull service this.pullMessageService.start(); // Start rebalance service this.rebalanceService.start(); // Start push service this.defaultMQProducer.getDefaultMQProducerImpl().start(false); log.info("the client factory [{}] start OK", this.clientId); this.serviceState = ServiceState.RUNNING; break; case RUNNING: break; case SHUTDOWN_ALREADY: break; case START_FAILED: throw new MQClientException("The Factory object[" + this.getClientId() + "] has been created before, and failed.", null); default: break; } } }
Example #24
Source File: DefaultMQAdminExtImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
@Override public void start() throws MQClientException { switch (this.serviceState) { case CREATE_JUST: this.serviceState = ServiceState.START_FAILED; this.defaultMQAdminExt.changeInstanceNameToPID(); this.mqClientInstance = MQClientManager.getInstance().getAndCreateMQClientInstance(this.defaultMQAdminExt, rpcHook); boolean registerOK = mqClientInstance.registerAdminExt(this.defaultMQAdminExt.getAdminExtGroup(), this); if (!registerOK) { this.serviceState = ServiceState.CREATE_JUST; throw new MQClientException("The adminExt group[" + this.defaultMQAdminExt.getAdminExtGroup() + "] has created already, specifed another name please." + FAQUrl.suggestTodo(FAQUrl.GROUP_NAME_DUPLICATE_URL), null); } mqClientInstance.start(); log.info("the adminExt [{}] start OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.RUNNING; break; case RUNNING: case START_FAILED: case SHUTDOWN_ALREADY: throw new MQClientException("The AdminExt service state not OK, maybe started once, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); default: break; } }
Example #25
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #26
Source File: DefaultMQAdminExtImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
@Override public void start() throws MQClientException { switch (this.serviceState) { case CREATE_JUST://服务只启动,不创建 this.serviceState = ServiceState.START_FAILED; this.defaultMQAdminExt.changeInstanceNameToPID(); // 创建mqclient对象 =》 this.mqClientInstance = MQClientManager.getInstance().getAndCreateMQClientInstance(this.defaultMQAdminExt, rpcHook); // 注册管理服务处理器=》 boolean registerOK = mqClientInstance.registerAdminExt(this.defaultMQAdminExt.getAdminExtGroup(), this); if (!registerOK) { this.serviceState = ServiceState.CREATE_JUST; throw new MQClientException("The adminExt group[" + this.defaultMQAdminExt.getAdminExtGroup() + "] has created already, specifed another name please." + FAQUrl.suggestTodo(FAQUrl.GROUP_NAME_DUPLICATE_URL), null); } // 启动mqclient =》 mqClientInstance.start(); log.info("the adminExt [{}] start OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.RUNNING; break; case RUNNING: case START_FAILED: case SHUTDOWN_ALREADY: throw new MQClientException("The AdminExt service state not OK, maybe started once, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); default: break; } }
Example #27
Source File: MQClientInstance.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public void start() throws MQClientException { synchronized (this) { switch (this.serviceState) { case CREATE_JUST://仅创建不启动 this.serviceState = ServiceState.START_FAILED; // If not specified,looking address from name server 如果启动的时候命令行没有指定name server的地址,就去获取 if (null == this.clientConfig.getNamesrvAddr()) { // 获取namesrv地址 this.mQClientAPIImpl.fetchNameServerAddr(); } // Start request-response channel 启动请求响应的channel =》 this.mQClientAPIImpl.start(); // Start various schedule tasks 启动调度任务=》 this.startScheduledTask(); // Start pull service 启动pull消息服务=》 this.pullMessageService.start(); // Start rebalance service 启动负载均衡服务=》 this.rebalanceService.start(); // Start push service 启动push服务=》 this.defaultMQProducer.getDefaultMQProducerImpl().start(false); log.info("the client factory [{}] start OK", this.clientId); this.serviceState = ServiceState.RUNNING; break; case RUNNING: break; case SHUTDOWN_ALREADY: break; case START_FAILED: throw new MQClientException("The Factory object[" + this.getClientId() + "] has been created before, and failed.", null); default: break; } } }
Example #28
Source File: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 5 votes |
private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, "// + this.serviceState// + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }
Example #29
Source File: DefaultMQAdminExtImpl.java From DDMQ with Apache License 2.0 | 5 votes |
@Override public void start() throws MQClientException { switch (this.serviceState) { case CREATE_JUST: this.serviceState = ServiceState.START_FAILED; this.defaultMQAdminExt.changeInstanceNameToPID(); this.mqClientInstance = MQClientManager.getInstance().getAndCreateMQClientInstance(this.defaultMQAdminExt, rpcHook); boolean registerOK = mqClientInstance.registerAdminExt(this.defaultMQAdminExt.getAdminExtGroup(), this); if (!registerOK) { this.serviceState = ServiceState.CREATE_JUST; throw new MQClientException("The adminExt group[" + this.defaultMQAdminExt.getAdminExtGroup() + "] has created already, specifed another name please." + FAQUrl.suggestTodo(FAQUrl.GROUP_NAME_DUPLICATE_URL), null); } mqClientInstance.start(); log.info("the adminExt [{}] start OK", this.defaultMQAdminExt.getAdminExtGroup()); this.serviceState = ServiceState.RUNNING; break; case RUNNING: case START_FAILED: case SHUTDOWN_ALREADY: throw new MQClientException("The AdminExt service state not OK, maybe started once, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); default: break; } }
Example #30
Source File: DefaultMQPushConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private void makeSureStateOK() throws MQClientException { if (this.serviceState != ServiceState.RUNNING) { throw new MQClientException("The consumer service state not OK, " + this.serviceState + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK), null); } }