JPushConfig.java 1.05 KB
package com.sl.ms.base.config;

import cn.jiguang.sdk.api.PushApi;
import feign.Logger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class JPushConfig {

    @Bean
    public PushApi pushApi() {
        return new PushApi.Builder()
                // .setClient(new feign.okhttp.OkHttpClient(okHttpClient)) // sdk默认使用的feign-okhttp,可自定义,可选
                // .setOptions(new Request.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true)) // 可自定义超时参数,可选
                // .setRetryer(new Retryer.Default(100, SECONDS.toMillis(1), 5)) // 可自定义重试参数,可选
                // .setLoggerLevel(Logger.Level.FULL) // 可自定义日志打印级别,可选
                .setAppKey("6f7829173a8ccb6c34653947") // 必填
                .setMasterSecret("d9f1963450bcd235eb2d3175") // 必填
                .setLoggerLevel(Logger.Level.FULL)
                .build();
    }
}