All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extspring.components.KafkaComponentExt Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.github.lontime.extspring.components;

import java.util.stream.Collectors;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;

import com.github.lontime.base.commonj.components.ComponentInterfaceHelper;
import com.github.lontime.extkafka.KafkaInstance;
import com.github.lontime.extkafka.listeners.KafkaConsumerListener;

/**
 * KafkaComponentExt.
 * @author lontime
 * @since 1.0
 */
public class KafkaComponentExt implements InitializingBean {

    private ObjectProvider listeners;

    @Autowired
    public void setJobInterfaces(ObjectProvider interfaces) {
        this.listeners = interfaces;
    }

    @Override
    public void afterPropertiesSet() {
        ComponentInterfaceHelper.register(listeners.stream()
                .filter(s -> s.getClazz() == KafkaConsumerListener.class).collect(Collectors.toList()));
        KafkaInstance.get();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy