package org.springblade.system.client.factory;

import lombok.extern.slf4j.Slf4j;
import org.springblade.system.client.MessageClient;

import org.springblade.system.client.model.MessageModel;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class MessageClientFallbackFactory implements FallbackFactory<MessageClient> {

    @Override
    public MessageClient create(Throwable cause) {
        log.error("MessageClient invoke fallback:{}", cause.getMessage());
        return new MessageClient() {

            @Override
            public void save(MessageModel messageModel) {

            }

            @Override
            public void saveBatch(List<MessageModel> list) {

            }
        };
    }
}
