perf: 修改EventBug名称 适配于全局事件

pull/29/head
Parker 3 years ago
parent 1c179f75d0
commit 5b5654b56e

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.opsli.core.log.bus;
package org.opsli.core.eventbus;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
@ -21,7 +21,6 @@ import com.google.common.eventbus.SubscriberExceptionContext;
import com.google.common.eventbus.SubscriberExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.opsli.common.thread.ThreadPoolFactory;
import org.opsli.core.eventbus.AbstractSpringEventBus;
import org.springframework.stereotype.Component;
import java.util.concurrent.ThreadPoolExecutor;
@ -34,11 +33,11 @@ import java.util.concurrent.TimeUnit;
*/
@Component
@Slf4j
public class OperationLogEventBus extends AbstractSpringEventBus implements SubscriberExceptionHandler {
public class SpringEventBus extends AbstractSpringEventBus implements SubscriberExceptionHandler {
private final EventBus eventBus;
public OperationLogEventBus() {
public SpringEventBus() {
// 异步事件配置线程池
eventBus = new AsyncEventBus(
ThreadPoolFactory.createInitThreadPool(5, 10, 60, TimeUnit.SECONDS,

@ -29,7 +29,7 @@ import org.opsli.core.base.dto.LoginUserDto;
import org.opsli.core.holder.UserContextHolder;
import org.opsli.core.log.annotation.OperateLogger;
import org.opsli.core.log.bean.OperationLog;
import org.opsli.core.log.bus.OperationLogEventBus;
import org.opsli.core.eventbus.SpringEventBus;
import org.opsli.core.log.enums.LogLevelEnum;
import org.opsli.core.log.enums.LogScopeEnum;
import org.opsli.core.utils.UserTokenUtil;
@ -57,7 +57,7 @@ public class OperateLogAspect {
private static final String RE = "\\$\\{([\\w\\.\\-\\/\\+\\$\\#\\@\\!\\^\\&\\(\\)]+)\\}";
@Resource
private OperationLogEventBus operationLogEventBus;
private SpringEventBus springEventBus;
@Pointcut("@annotation(org.opsli.core.log.annotation.OperateLogger)")
public void operationLog(){}
@ -156,7 +156,7 @@ public class OperateLogAspect {
}
// 存入数据库
if(annotation.db()){
operationLogEventBus.post(operationLog);
springEventBus.post(operationLog);
}
}

Loading…
Cancel
Save