com.alibaba.rocketmq.common.protocol.heartbeat.HeartbeatData Java Examples
The following examples show how to use
com.alibaba.rocketmq.common.protocol.heartbeat.HeartbeatData.
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: MQClientAPIImpl.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 6 votes |
public void sendHearbeat(// final String addr,// final HeartbeatData heartbeatData,// final long timeoutMillis// ) throws RemotingException, MQBrokerException, InterruptedException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeatData.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
Example #2
Source File: MQClientAPIImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void sendHearbeat(// final String addr, // final HeartbeatData heartbeatData, // final long timeoutMillis// ) throws RemotingException, MQBrokerException, InterruptedException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeatData.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
Example #3
Source File: MQClientAPIImpl.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public boolean registerClient(final String addr, final HeartbeatData heartbeat, final long timeoutMillis) throws RemotingException, InterruptedException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeat.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); return response.getCode() == ResponseCode.SUCCESS; }
Example #4
Source File: MQClientAPIImpl.java From rocketmq with Apache License 2.0 | 5 votes |
public boolean registerClient(final String addr, final HeartbeatData heartbeat, final long timeoutMillis) throws RemotingException, InterruptedException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeat.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); return response.getCode() == ResponseCode.SUCCESS; }
Example #5
Source File: MQClientAPIImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
/** * Client向Client发送心跳,并注册自身 * * @param addr * @param heartbeatData * @param timeoutMillis * @throws RemotingException * @throws MQBrokerException * @throws InterruptedException */ public void sendHearbeat(final String addr, final HeartbeatData heartbeatData, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException { if (!UtilAll.isBlank(projectGroupPrefix)) { Set<ConsumerData> consumerDatas = heartbeatData.getConsumerDataSet(); for (ConsumerData consumerData : consumerDatas) { consumerData.setGroupName( VirtualEnvUtil.buildWithProjectGroup(consumerData.getGroupName(), projectGroupPrefix)); Set<SubscriptionData> subscriptionDatas = consumerData.getSubscriptionDataSet(); for (SubscriptionData subscriptionData : subscriptionDatas) { subscriptionData.setTopic(VirtualEnvUtil .buildWithProjectGroup(subscriptionData.getTopic(), projectGroupPrefix)); } } Set<ProducerData> producerDatas = heartbeatData.getProducerDataSet(); for (ProducerData producerData : producerDatas) { producerData.setGroupName( VirtualEnvUtil.buildWithProjectGroup(producerData.getGroupName(), projectGroupPrefix)); } } RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeatData.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
Example #6
Source File: MQClientAPIImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
/** * 注册client * * @param addr * @param heartbeat * @param timeoutMillis * @return * @throws RemotingException * @throws InterruptedException */ public boolean registerClient(final String addr, final HeartbeatData heartbeat, final long timeoutMillis) throws RemotingException, InterruptedException { if (!UtilAll.isBlank(projectGroupPrefix)) { Set<ConsumerData> consumerDatas = heartbeat.getConsumerDataSet(); for (ConsumerData consumerData : consumerDatas) { consumerData.setGroupName( VirtualEnvUtil.buildWithProjectGroup(consumerData.getGroupName(), projectGroupPrefix)); Set<SubscriptionData> subscriptionDatas = consumerData.getSubscriptionDataSet(); for (SubscriptionData subscriptionData : subscriptionDatas) { subscriptionData.setTopic(VirtualEnvUtil .buildWithProjectGroup(subscriptionData.getTopic(), projectGroupPrefix)); } } Set<ProducerData> producerDatas = heartbeat.getProducerDataSet(); for (ProducerData producerData : producerDatas) { producerData.setGroupName( VirtualEnvUtil.buildWithProjectGroup(producerData.getGroupName(), projectGroupPrefix)); } } RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT, null); request.setBody(heartbeat.encode()); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); return response.getCode() == ResponseCode.SUCCESS; }