Java Code Examples for com.xxl.job.core.biz.AdminBiz#callback()

The following examples show how to use com.xxl.job.core.biz.AdminBiz#callback() . 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: TriggerCallbackThread.java    From open-capacity-platform with Apache License 2.0 6 votes vote down vote up
/**
 * do callback, will retry if error
 * @param callbackParamList
 */
private void doCallback(List<HandleCallbackParam> callbackParamList){
    // callback, will retry if error
    for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
        try {
            ReturnT<String> callbackResult = adminBiz.callback(callbackParamList);
            if (callbackResult!=null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) {
                callbackResult = ReturnT.SUCCESS;
                logger.info(">>>>>>>>>>> xxl-job callback success, callbackParamList:{}, callbackResult:{}", new Object[]{callbackParamList, callbackResult});
                break;
            } else {
                logger.info(">>>>>>>>>>> xxl-job callback fail, callbackParamList:{}, callbackResult:{}", new Object[]{callbackParamList, callbackResult});
            }
        } catch (Exception e) {
            logger.error(">>>>>>>>>>> xxl-job callback error, callbackParamList:{}", callbackParamList, e);
            //getInstance().callBackQueue.addAll(callbackParamList);
        }
    }
}
 
Example 2
Source File: TriggerCallbackThread.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
/**
 * do callback, will retry if error
 * @param callbackParamList
 */
private void doCallback(List<HandleCallbackParam> callbackParamList){
    boolean callbackRet = false;
    // callback, will retry if error
    for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
        try {
            ReturnT<String> callbackResult = adminBiz.callback(callbackParamList);
            if (callbackResult!=null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback finish.");
                callbackRet = true;
                break;
            } else {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback fail, callbackResult:" + callbackResult);
            }
        } catch (Exception e) {
            callbackLog(callbackParamList, "<br>----------- xxl-job job callback error, errorMsg:" + e.getMessage());
        }
    }
    if (!callbackRet) {
        appendFailCallbackFile(callbackParamList);
    }
}
 
Example 3
Source File: TriggerCallbackThread.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
/**
 * do callback, will retry if error
 *
 * @param callbackParamList
 */
private void doCallback(List<HandleCallbackParam> callbackParamList) {
    boolean callbackRet = false;
    // callback, will retry if error
    for (AdminBiz adminBiz : XxlJobExecutor.getAdminBizList()) {
        try {
            ReturnT<String> callbackResult = adminBiz.callback(callbackParamList);
            if (callbackResult != null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback finish.");
                callbackRet = true;
                break;
            } else {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback fail, callbackResult:" + callbackResult);
            }
        } catch (Exception e) {
            callbackLog(callbackParamList, "<br>----------- xxl-job job callback error, errorMsg:" + e.getMessage());
        }
    }
    if (!callbackRet) {
        appendFailCallbackFile(callbackParamList);
    }
}
 
Example 4
Source File: TriggerCallbackThread.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * do callback, will retry if error
 *
 * @param callbackParamList
 */
private void doCallback(List<HandleCallbackParam> callbackParamList) {
    boolean callbackRet = false;
    // callback, will retry if error
    for (AdminBiz adminBiz : XxlJobExecutor.getAdminBizList()) {
        try {
            ReturnT<String> callbackResult = adminBiz.callback(callbackParamList);
            if (callbackResult != null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback finish.");
                callbackRet = true;
                break;
            } else {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback fail, callbackResult:" + callbackResult);
            }
        } catch (Exception e) {
            callbackLog(callbackParamList, "<br>----------- xxl-job job callback error, errorMsg:" + e.getMessage());
        }
    }
    if (!callbackRet) {
        appendFailCallbackFile(callbackParamList);
    }
}
 
Example 5
Source File: TriggerCallbackThread.java    From xxl-job with GNU General Public License v3.0 6 votes vote down vote up
/**
 * do callback, will retry if error
 * @param callbackParamList
 */
private void doCallback(List<HandleCallbackParam> callbackParamList){
    boolean callbackRet = false;
    // callback, will retry if error
    for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
        try {
            ReturnT<String> callbackResult = adminBiz.callback(callbackParamList);
            if (callbackResult!=null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback finish.");
                callbackRet = true;
                break;
            } else {
                callbackLog(callbackParamList, "<br>----------- xxl-job job callback fail, callbackResult:" + callbackResult);
            }
        } catch (Exception e) {
            callbackLog(callbackParamList, "<br>----------- xxl-job job callback error, errorMsg:" + e.getMessage());
        }
    }
    if (!callbackRet) {
        appendFailCallbackFile(callbackParamList);
    }
}
 
Example 6
Source File: AdminBizTest.java    From xxl-job with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void callback() throws Exception {
    AdminBiz adminBiz = new AdminBizClient(addressUrl, accessToken);

    HandleCallbackParam param = new HandleCallbackParam();
    param.setLogId(1);
    param.setExecuteResult(ReturnT.SUCCESS);

    List<HandleCallbackParam> callbackParamList = Arrays.asList(param);

    ReturnT<String> returnT = adminBiz.callback(callbackParamList);

    Assert.assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
}