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

io.automatiko.addons.graphql.GraphQLEventPublisher Maven / Gradle / Ivy

The newest version!
package io.automatiko.addons.graphql;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import jakarta.enterprise.context.ApplicationScoped;

import io.automatiko.engine.api.event.DataEvent;
import io.automatiko.engine.api.event.EventPublisher;

@ApplicationScoped
public class GraphQLEventPublisher implements EventPublisher {

    private Set> subscribers = new HashSet<>();

    @Override
    public void publish(DataEvent event) {

        subscribers.forEach(s -> s.process(event));

    }

    @Override
    public void publish(Collection> events) {
        events.forEach(this::publish);

    }

    public void register(GraphQLSubscriptionEventPublisher subscriber) {
        this.subscribers.add(subscriber);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy