use of org.apache.rocketmq.remoting.RemotingClient in project rocketmq-externals by apache.
the class MQAdminExtImpl method examineTopicConfig.
@Override
public TopicConfig examineTopicConfig(String addr, String topic) {
RemotingClient remotingClient = MQAdminInstance.threadLocalRemotingClient();
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);
RemotingCommand response = null;
try {
response = remotingClient.invokeSync(addr, request, 3000);
} catch (Exception err) {
throw Throwables.propagate(err);
}
switch(response.getCode()) {
case ResponseCode.SUCCESS:
{
TopicConfigSerializeWrapper topicConfigSerializeWrapper = decode(response.getBody(), TopicConfigSerializeWrapper.class);
return topicConfigSerializeWrapper.getTopicConfigTable().get(topic);
}
default:
throw Throwables.propagate(new MQBrokerException(response.getCode(), response.getRemark()));
}
}
use of org.apache.rocketmq.remoting.RemotingClient in project pinpoint by naver.
the class DefaultMQPushConsumerImplStartInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
DefaultMQPushConsumerImpl consumerImpl = (DefaultMQPushConsumerImpl) target;
MessageListener messageListener = consumerImpl.getDefaultMQPushConsumer().getMessageListener();
MQClientInstanceGetter mqClientInstanceGetter = (MQClientInstanceGetter) target;
MQClientInstance mqClientInstance = mqClientInstanceGetter._$PINPOINT$_getMQClientInstance();
RemotingClient remotingClient = mqClientInstance.getMQClientAPIImpl().getRemotingClient();
if (remotingClient instanceof NettyRemotingClient) {
ChannelTablesGetter nettyRemotingClient = (ChannelTablesGetter) remotingClient;
ChannelTablesAccessor channelTablesAccessor = (ChannelTablesAccessor) messageListener;
channelTablesAccessor._$PINPOINT$_setChannelTables(nettyRemotingClient._$PINPOINT$_getChannelTables());
}
}
use of org.apache.rocketmq.remoting.RemotingClient in project rocketmq-externals by apache.
the class MQAdminExtImpl method examineSubscriptionGroupConfig.
@Override
public SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group) {
RemotingClient remotingClient = MQAdminInstance.threadLocalRemotingClient();
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null);
RemotingCommand response = null;
try {
response = remotingClient.invokeSync(addr, request, 3000);
} catch (Exception err) {
throw Throwables.propagate(err);
}
assert response != null;
switch(response.getCode()) {
case ResponseCode.SUCCESS:
{
SubscriptionGroupWrapper subscriptionGroupWrapper = decode(response.getBody(), SubscriptionGroupWrapper.class);
return subscriptionGroupWrapper.getSubscriptionGroupTable().get(group);
}
default:
throw Throwables.propagate(new MQBrokerException(response.getCode(), response.getRemark()));
}
}
Aggregations