package com.hzs.filter;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;
import org.springframework.context.i18n.LocaleContextHolder;

/**
 * @Description: 会员dubbo服务消费过滤器
 * @Author: jiang chao
 * @Time: 2023/9/5 11:42
 * @Classname: RpcFilter
 * @PackageName: com.hzs.filter
 */
@Activate(group = CommonConstants.CONSUMER)
@Slf4j
public class SystemConsumerFilter implements Filter {

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        RpcContext.getContext().setAttachment("locale", LocaleContextHolder.getLocale().toLanguageTag());
        return invoker.invoke(invocation);
    }

}
