package com.eactive.eai.common.logger.async;

import com.eactive.eai.common.logger.HttpLoggingService;
import com.eactive.eai.common.util.ApplicationContextProvider;
import com.eactive.eai.common.util.Logger;
import com.lmax.disruptor.WorkHandler;

public class HttpLoggingWorkHandler implements WorkHandler<HttpLoggingEvent> {
    static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
    @Override
    public void onEvent(HttpLoggingEvent httpLoggingEvent) throws Exception {
        HttpLoggingService service = ApplicationContextProvider.getContext().getBean(HttpLoggingService.class);
        try {
            service.insertHttpAdapterExtraLog( httpLoggingEvent.getHttpAdapterExtraLogVo());
        } catch (Throwable th) {
            logger.error("failed to insert async http log ", th);
        }
    }
}
