use of com.alibaba.rocketmq.client.consumer.PullCallback in project uavstack by uavorg.
the class RocketmqIT method doBefore.
public Object doBefore(Object mqClient, String methodName, Object[] args) {
String address = getServerAddr(mqClient);
String topic = getTopic(mqClient, methodName, args);
String url = address + (null == topic ? "" : "/" + topic);
Map<String, Object> params = new HashMap<String, Object>();
params.put(CaptureConstants.INFO_CLIENT_REQUEST_URL, url);
params.put(CaptureConstants.INFO_CLIENT_REQUEST_ACTION, methodName);
params.put(CaptureConstants.INFO_CLIENT_APPID, applicationId);
params.put(CaptureConstants.INFO_CLIENT_TYPE, "rocketmq.client");
if (logger.isDebugable()) {
logger.debug("Invoke START:" + url + ",op=" + methodName, null);
}
// proxy the PullCallback
if (methodName.equals("pull")) {
PullCallback callback = null;
if (PullCallback.class.isAssignableFrom(args[args.length - 1].getClass())) {
callback = (PullCallback) args[args.length - 1];
} else if (PullCallback.class.isAssignableFrom(args[args.length - 1].getClass())) {
callback = (PullCallback) args[args.length - 2];
}
if (null != callback) {
callback = JDKProxyInvokeUtil.newProxyInstance(PullCallback.class.getClassLoader(), new Class<?>[] { PullCallback.class }, new JDKProxyInvokeHandler<PullCallback>(callback, new PullCallbackProxyProcessor()));
ccMap = UAVServer.instance().runMonitorAsyncCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT, Monitor.CapturePhase.PRECAP, params, ccMap);
// ivc
ivcContext = captureInvokeChain(RocketMQPullConsumerAdapter.class, InvokeChainConstants.CapturePhase.PRECAP, params, args);
return callback;
}
}
UAVServer.instance().runMonitorCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT, Monitor.CapturePhase.PRECAP, params);
if (methodName.startsWith("send")) {
// ivc
ivcContext = captureInvokeChain(RocketMQProducerAdapter.class, InvokeChainConstants.CapturePhase.PRECAP, params, args);
}
return null;
}
Aggregations