You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/stream-analytics/stream-analytics-real-time-fraud-detection.md
+33-33Lines changed: 33 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,9 +61,9 @@ In this procedure, you first create an event hub namespace, and then you add an
61
61
62
62
4. In the **Create namespace** pane, enter a namespace name such as `<yourname>-eh-ns-demo`. You can use any name for the namespace, but the name must be valid for a URL and it must be unique across Azure.
63
63
64
-
5. Select a subscription and create or choose a resource group, then click **Create**.
64
+
5. Select a subscription and create or choose a resource group, then click **Create**.<br/><br/>
65
65
66
-
<imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-eventhub-namespace-new-portal.png"alt="Create event hub namespace in Azure portal"width="300px"/>
66
+
<br/><br/><imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-eventhub-namespace-new-portal.png"alt="Create event hub namespace in Azure portal"width="300px"/>
67
67
68
68
6. When the namespace has finished deploying, find the event hub namespace in your list of Azure resources.
69
69
@@ -73,7 +73,7 @@ In this procedure, you first create an event hub namespace, and then you add an
73
73
74
74
8. Name the new event hub `asa-eh-frauddetection-demo`. You can use a different name. If you do, make a note of it, because you need the name later. You don't need to set any other options for the event hub right now.
75
75
76
-
<imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-eventhub-new-portal.png"alt="Name event hub in Azure portal"width="400px"/>
76
+
<br/><br/><imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-eventhub-new-portal.png"alt="Name event hub in Azure portal"width="400px"/>
77
77
78
78
9. Click **Create**.
79
79
@@ -90,15 +90,15 @@ Before a process can send data to an event hub, the event hub must have a policy
90
90
91
91
3. Add a policy named `asa-policy-manage-demo` and for **Claim**, select **Manage**.
92
92
93
-
<imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-shared-access-policy-manage-new-portal.png"alt="Create shared access policy for Stream Analytics"width="300px"/>
93
+
<br/><br/><imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-shared-access-policy-manage-new-portal.png"alt="Create shared access policy for Stream Analytics"width="300px"/>
94
94
95
95
4. Click **Create**.
96
96
97
97
5. After the policy has been deployed, click it in the list of shared access policies.
98
98
99
99
6. Find the box labeled **CONNECTION STRING-PRIMARY KEY** and click the copy button next to the connection string.
7. Paste the connection string into a text editor. You need this connection string for the next section, after you make some small edits to it.
104
104
@@ -142,7 +142,7 @@ Before you start the TelcoGenerator app, you must configure it so that it will s
142
142
143
143
2. Enter the following command:
144
144
145
-
```cmd
145
+
```console
146
146
telcodatagen.exe 1000 0.2 2
147
147
```
148
148
@@ -178,7 +178,7 @@ Now that you have a stream of call events, you can set up a Stream Analytics job
178
178
179
179
It's a good idea to place the job and the event hub in the same region for best performance and so that you don't pay to transfer data between regions.
180
180
181
-
<imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-sa-job-new-portal.png"alt="Create Stream Analytics job in portal"width="300px"/>
181
+
<br/><br/><imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-create-sa-job-new-portal.png"alt="Create Stream Analytics job in portal"width="300px"/>
182
182
183
183
3. Click **Create**.
184
184
@@ -271,11 +271,11 @@ In many cases, your analysis doesn't need all the columns from the input stream.
271
271
272
272
1. Change the query in the code editor to the following:
@@ -289,13 +289,13 @@ For this transformation, you want a sequence of temporal windows that don't over
289
289
290
290
1. Change the query in the code editor to the following:
291
291
292
-
```SQL
293
-
SELECT
294
-
System.Timestamp as WindowEnd, SwitchNum, COUNT(*) as CallCount
295
-
FROM
296
-
CallStream TIMESTAMP BY CallRecTime
297
-
GROUP BY TUMBLINGWINDOW(s, 5), SwitchNum
298
-
```
292
+
```SQL
293
+
SELECT
294
+
System.Timestamp as WindowEnd, SwitchNum, COUNT(*) as CallCount
295
+
FROM
296
+
CallStream TIMESTAMP BY CallRecTime
297
+
GROUP BY TUMBLINGWINDOW(s, 5), SwitchNum
298
+
```
299
299
300
300
This query uses the `Timestamp By` keyword in the `FROM` clause to specify which timestamp field in the input stream to use to define the Tumbling window. In this case, the window divides the data into segments by the `CallRecTime` field in each record. (If no field is specified, the windowing operation uses the time that each event arrives at the event hub. See "Arrival Time Vs Application Time" in [Stream Analytics Query Language Reference](https://docs.microsoft.com/stream-analytics-query/stream-analytics-query-language-reference).
301
301
@@ -317,19 +317,19 @@ When you use a join with streaming data, the join must provide some limits on ho
317
317
318
318
1. Change the query in the code editor to the following:
319
319
320
-
```SQL
321
-
SELECT System.Timestamp as Time,
322
-
CS1.CallingIMSI,
323
-
CS1.CallingNum as CallingNum1,
324
-
CS2.CallingNum as CallingNum2,
325
-
CS1.SwitchNum as Switch1,
326
-
CS2.SwitchNum as Switch2
327
-
FROM CallStream CS1 TIMESTAMP BY CallRecTime
328
-
JOIN CallStream CS2 TIMESTAMP BY CallRecTime
329
-
ON CS1.CallingIMSI = CS2.CallingIMSI
330
-
AND DATEDIFF(ss, CS1, CS2) BETWEEN 1 AND 5
331
-
WHERE CS1.SwitchNum != CS2.SwitchNum
332
-
```
320
+
```SQL
321
+
SELECT System.Timestamp as Time,
322
+
CS1.CallingIMSI,
323
+
CS1.CallingNum as CallingNum1,
324
+
CS2.CallingNum as CallingNum2,
325
+
CS1.SwitchNum as Switch1,
326
+
CS2.SwitchNum as Switch2
327
+
FROM CallStream CS1 TIMESTAMP BY CallRecTime
328
+
JOIN CallStream CS2 TIMESTAMP BY CallRecTime
329
+
ON CS1.CallingIMSI = CS2.CallingIMSI
330
+
AND DATEDIFF(ss, CS1, CS2) BETWEEN 1 AND 5
331
+
WHERE CS1.SwitchNum != CS2.SwitchNum
332
+
```
333
333
334
334
This query is like any SQL join except for the `DATEDIFF` function in the join. This version of `DATEDIFF` is specific to Streaming Analytics, and it must appear in the `ON...BETWEEN` clause. The parameters are a time unit (seconds in this example) and the aliases of the two sources for the join. This is different from the standard SQL `DATEDIFF` function.
335
335
@@ -341,7 +341,7 @@ When you use a join with streaming data, the join must provide some limits on ho
341
341
342
342
3. Click **Save** to save the self-join query as part of the Streaming Analytics job. (It doesn't save the sample data.)
343
343
344
-
<imgsrc="./media/stream-analytics-real-time-fraud-detection/stream-analytics-query-editor-save-button-new-portal.png"alt="Save Stream Analytics query in portal"width="300px"/>
344
+
<br/><br/><img src="./media/stream-analytics-real-time-fraud-detection/stream-analytics-query-editor-save-button-new-portal.png" alt="Save Stream Analytics query in portal" width="300px"/>
345
345
346
346
## Create an output sink to store transformed data
0 commit comments