Paste #121158

   
pasted on 08.05.2019 07:31
  • Edit to this paste
  • Print
  • Raw
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
		stream<rstring IIN, rstring STARTDATE, rstring CHANNEL, rstring PHONE_NUMBER, rstring DEVICE_TOKEN, rstring DEVICE_OS, rstring MESSAGE> cond = Custom(selectStreamsOutput; interactResponse) {
			logic
				state: {
					timestamp ts = getTimestamp();
					mutable rstring msgType = "";
					mutable boolean existsSO = false;
					mutable boolean statement = false ;
				} 
				onTuple selectStreamsOutput: {
					println(TOTAL);
					if ((int32)TOTAL >= (int32)1) {
						existsSO = true;
					} else {
						existsSO = false;
					}
				}
				onTuple interactResponse: {
					println("Exists row(interact): "+(rstring)existsSO);
					if (!existsSO) {
						if(row.DEVICE_TOKEN == "" || row.DEVICE_OS == "" && row.PHONE_NUMBER != "") {
							msgType = "SMS_SEND";
						} else  if (row.DEVICE_TOKEN != "" && row.DEVICE_OS != "" && row.PHONE_NUMBER != "") {
							msgType = "PUSH_SEND";
						}
						submit({ 
							IIN = row.IIN, 
							STARTDATE = getLocalString(ts, "%Y-%m-%dT%H:%M:%S.") + (rstring)(getNanoseconds(ts) / 1000u), 
							CHANNEL = msgType,
							PHONE_NUMBER = row.PHONE_NUMBER, 
							DEVICE_TOKEN = row.DEVICE_TOKEN, 
							DEVICE_OS = row.DEVICE_OS,
							MESSAGE = row.TITLE+" "+row.FIRSTNAME+"! "+row.MESSAGE
						}, cond) ;
					}
				}
		}
Add Comment
Author