001/*
002 * (C) Copyright 2020 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     bdelbosc
018 */
019package org.nuxeo.ecm.core.bulk.introspection;
020
021import static org.nuxeo.lib.stream.computation.AbstractComputation.INPUT_1;
022import static org.nuxeo.lib.stream.computation.AbstractComputation.INPUT_2;
023import static org.nuxeo.lib.stream.computation.log.LogStreamManager.METRICS_STREAM;
024import static org.nuxeo.lib.stream.computation.log.LogStreamManager.PROCESSORS_STREAM;
025
026import java.util.Arrays;
027import java.util.Map;
028
029import org.nuxeo.lib.stream.computation.Topology;
030import org.nuxeo.runtime.stream.StreamProcessorTopology;
031
032/**
033 * A processor to introspect Nuxeo Stream activities at the cluster level.
034 *
035 * @since 11.5
036 */
037public class StreamIntrospectionProcessor implements StreamProcessorTopology {
038
039    @Override
040    public Topology getTopology(Map<String, String> options) {
041        return Topology.builder()
042                       .addComputation(() -> new StreamIntrospectionComputation(),
043                               Arrays.asList(INPUT_1 + ":" + PROCESSORS_STREAM, INPUT_2 + ":" + METRICS_STREAM))
044                       .build();
045    }
046
047}