<commit_before>package io.axoniq.axonhub.client.processor.grpc;

import io.axoniq.axonhub.client.PlatformConnectionManager;
import io.axoniq.axonhub.client.processor.AxonHubEventProcessorInfoSource;
import org.axonframework.config.EventHandlingConfiguration;
import org.axonframework.eventhandling.EventProcessor;
import org.axonframework.eventhandling.SubscribingEventProcessor;
import org.axonframework.eventhandling.TrackingEventProcessor;

import java.util.List;

/**
 * Created by <NAME> on 15/03/2018.
 * <EMAIL>
 */
public class GrpcEventProcessorInfoSource implements AxonHubEventProcessorInfoSource {

    private final EventHandlingConfiguration eventHandlingConfiguration;

    private final PlatformConnectionManager platformConnectionManager;

    public GrpcEventProcessorInfoSource(EventHandlingConfiguration eventHandlingConfiguration,
                                        PlatformConnectionManager platformConnectionManager) {
        this.eventHandlingConfiguration = eventHandlingConfiguration;
        this.platformConnectionManager = platformConnectionManager;
    }

    @Override
    public void notifyInformation() {
        List<EventProcessor> processors = eventHandlingConfiguration.getProcessors();
        processors.forEach(processor -> {
            PlatformInboundMessage message = messageFor(processor);
            platformConnectionManager.send(message.instruction());
        });
    }

    private PlatformInboundMessage messageFor(EventProcessor processor){
        if (processor instanceof TrackingEventProcessor)
            return new TrackingEventProcessorInfoMessage((TrackingEventProcessor) processor);
        if (processor instanceof SubscribingEventProcessor)
            return new SubscribingEventProcessorInfoMessage((SubscribingEventProcessor) processor);
        return null;
    }

}<commit_msg>Event processor control API - Throw exception if EventProcessor is neither Tracking nor Subscribing<commit_after>package io.axoniq.axonhub.client.processor.grpc;

import io.axoniq.axonhub.client.PlatformConnectionManager;
import io.axoniq.axonhub.client.processor.AxonHubEventProcessorInfoSource;
import org.axonframework.config.EventHandlingConfiguration;
import org.axonframework.eventhandling.EventProcessor;
import org.axonframework.eventhandling.SubscribingEventProcessor;
import org.axonframework.eventhandling.TrackingEventProcessor;

import java.util.List;

/**
 * Created by <NAME> on 15/03/2018.
 * <EMAIL>
 */
public class GrpcEventProcessorInfoSource implements AxonHubEventProcessorInfoSource {

    private final EventHandlingConfiguration eventHandlingConfiguration;

    private final PlatformConnectionManager platformConnectionManager;

    public GrpcEventProcessorInfoSource(EventHandlingConfiguration eventHandlingConfiguration,
                                        PlatformConnectionManager platformConnectionManager) {
        this.eventHandlingConfiguration = eventHandlingConfiguration;
        this.platformConnectionManager = platformConnectionManager;
    }

    @Override
    public void notifyInformation() {
        List<EventProcessor> processors = eventHandlingConfiguration.getProcessors();
        processors.forEach(processor -> {
            PlatformInboundMessage message = messageFor(processor);
            platformConnectionManager.send(message.instruction());
        });
    }

    private PlatformInboundMessage messageFor(EventProcessor processor){
        if (processor instanceof TrackingEventProcessor)
            return new TrackingEventProcessorInfoMessage((TrackingEventProcessor) processor);
        if (processor instanceof SubscribingEventProcessor)
            return new SubscribingEventProcessorInfoMessage((SubscribingEventProcessor) processor);
        throw new RuntimeException("Unknown instance of Event Processor detected.");
    }

}
{'fraction_non_alphanumeric': 0.0628245067497404, 'fraction_numerical': 0.004153686396677051, 'mean_word_length': 4.567919075144508, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3320609', 'n_tokens_mistral': 902, 'n_tokens_neox': 854, 'n_words': 174}