0

Je suis en train de filtrer tous les événements temporaires qui sont> 10 à l'aide Flink ci-dessous, modèlewarnings.print() imprime les événements dans l'ordre inverse (dernier événement en premier) excepte premier événement Apache Flink CEP

Pattern<MonitoringEvent, ?> warningPattern = Pattern.<MonitoringEvent>begin("first") 
       .subtype(TemperatureEvent.class) 
       .where(new FilterFunction<TemperatureEvent>() { 
        @Override 
        public boolean filter(TemperatureEvent temperatureEvent) throws Exception { 
         return temperatureEvent.getTemperature() > 50; 
        } 
       }); 

l'entrée est un fichier texte, qui est analysé à diffuser par une fonction d'entrée, le contenu du fichier d'entrée sont les suivants: -

1,98 
2,33 
3,44 
4,55 
5,66 
6,88 
7,99 
8,76 

ici première valeur est Rack_id et la seconde est la température

J'ai donné l'impression() sur deux entrées-stream et WarnigsStream comme indiqué ci-dessous

inputEventStream.print(); 
warnings.print(); 

Maintenant, vient la question, la sortie du Flink CEP est illustré ci-dessous

08/10/2017 23:43:15 Job execution switched to status RUNNING. 
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to SCHEDULED 
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to DEPLOYING 
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to SCHEDULED 
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to DEPLOYING 
08/10/2017 23:43:15 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to RUNNING 
08/10/2017 23:43:15 Source: Custom Source -> Sink: Unnamed(1/1) switched to RUNNING 
Rack id = 1 and temprature = 98.0) 
Rack id = 2 and temprature = 33.0) 
Rack id = 3 and temprature = 44.0) 
Rack id = 4 and temprature = 55.0) 
Rack id = 5 and temprature = 66.0) 
Rack id = 6 and temprature = 88.0) 
Rack id = 7 and temprature = 99.0) 
Rack id = 8 and temprature = 76.0) 
08/10/2017 23:43:16 Source: Custom Source -> Sink: Unnamed(1/1) switched to FINISHED 
Rack id = 1 and temprature = 98.0) 
Rack id = 8 and temprature = 76.0) 
Rack id = 7 and temprature = 99.0) 
Rack id = 6 and temprature = 88.0) 
Rack id = 5 and temprature = 66.0) 
Rack id = 4 and temprature = 55.0) 
08/10/2017 23:43:16 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to FINISHED 
08/10/2017 23:43:16 Job execution switched to status FINISHED. 

Process finished with exit code 0 

Comme on peut le voir, le premier événement complexe (rack id = 1 et température = 98,0)) est imprimé dans le même ordre, mais après cela, tous les autres événements complexes ayant une température> 50 sont imprimés dans l'ordre inverse par rapport au flux d'entrée.

My questions are :- 

1. Any idea why events are getting printed in reverse order? 
2. Is there a custom way to print values{w/o using warnings.print()} of 
    warning stream, like can I print only temperature, rather than rack-id ? 

Merci à l'avance

Répondre

0

Ce problème a été résolu en attribuant Horodatage et Filigranes à INPUTSTREAM présentés comme ci-dessous

// Input stream of monitoring events 
     DataStream<MonitoringEvent> inputEventStream = env 
       .addSource(new InputStreamAGenerator()).assignTimestampsAndWatermarks(new IngestionTimeExtractor<>()); 

sortie généré est illustré ci-dessous

08/11/2017 00:45:09 Job execution switched to status RUNNING. 
    08/11/2017 00:45:09 Source: Custom Source -> Timestamps/Watermarks(1/1) switched to SCHEDULED 
    08/11/2017 00:45:09 Source: Custom Source -> Timestamps/Watermarks(1/1) switched to DEPLOYING 
    08/11/2017 00:45:09 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to SCHEDULED 
    08/11/2017 00:45:09 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to DEPLOYING 
    08/11/2017 00:45:09 Source: Custom Source -> Timestamps/Watermarks(1/1) switched to RUNNING 
    08/11/2017 00:45:09 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to RUNNING 
    Rack id = 1 and temprature = 98.0) 
    Rack id = 4 and temprature = 55.0) 
    Rack id = 5 and temprature = 66.0) 
    Rack id = 6 and temprature = 88.0) 
    Rack id = 7 and temprature = 99.0) 
    Rack id = 8 and temprature = 76.0) 
    08/11/2017 00:45:10 Source: Custom Source -> Timestamps/Watermarks(1/1) switched to FINISHED 
    08/11/2017 00:45:10 AbstractCEPPatternOperator -> Map -> Sink: Unnamed(1/1) switched to FINISHED 
    08/11/2017 00:45:10 Job execution switched to status FINISHED.