Skip to content

Commit 8ea9e17

Browse files
authored
Java V2 Add the Firehose scenario (#7144)
1 parent c58d011 commit 8ea9e17

File tree

14 files changed

+13111
-382
lines changed

14 files changed

+13111
-382
lines changed

.doc_gen/metadata/firehose_metadata.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# zexi 0.4.0
22
firehose_PutRecord:
33
languages:
4+
Java:
5+
versions:
6+
- sdk_version: 2
7+
github: javav2/example_code/firehose
8+
excerpts:
9+
- description:
10+
snippet_tags:
11+
- firehose.java2.put_record.main
412
Python:
513
versions:
614
- sdk_version: 3
@@ -14,6 +22,14 @@ firehose_PutRecord:
1422
firehose: {PutRecord}
1523
firehose_PutRecordBatch:
1624
languages:
25+
Java:
26+
versions:
27+
- sdk_version: 2
28+
github: javav2/example_code/firehose
29+
excerpts:
30+
- description:
31+
snippet_tags:
32+
- firehose.java2.put_batch_records.main
1733
Rust:
1834
versions:
1935
- sdk_version: 1
@@ -40,6 +56,14 @@ firehose_Scenario_PutRecords:
4056
synopsis: use &FH; to process individual and batch records.
4157
category: Scenarios
4258
languages:
59+
Java:
60+
versions:
61+
- sdk_version: 2
62+
github: javav2/example_code/firehose
63+
excerpts:
64+
- description: This example puts individual and batch records to &FH;.
65+
snippet_tags:
66+
- firehose.java2.scenario.main
4367
Python:
4468
versions:
4569
- sdk_version: 3

javav2/example_code/firehose/README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `javav
2929
<!--custom.prerequisites.start-->
3030
<!--custom.prerequisites.end-->
3131

32+
### Single actions
33+
34+
Code excerpts that show you how to call individual service functions.
35+
36+
- [PutRecord](src/main/java/com/example/firehose/scenario/FirehoseScenario.java#L92)
37+
- [PutRecordBatch](src/main/java/com/example/firehose/scenario/FirehoseScenario.java#L125)
38+
39+
### Scenarios
40+
41+
Code examples that show you how to accomplish a specific task by calling multiple
42+
functions within the same service.
43+
44+
- [Put records to Data Firehose](src/main/java/com/example/firehose/scenario/FirehoseScenario.java)
45+
46+
3247
<!--custom.examples.start-->
3348
<!--custom.examples.end-->
3449

@@ -42,6 +57,18 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `javav
4257

4358

4459

60+
#### Put records to Data Firehose
61+
62+
This example shows you how to use Data Firehose to process individual and batch records.
63+
64+
65+
<!--custom.scenario_prereqs.firehose_Scenario_PutRecords.start-->
66+
<!--custom.scenario_prereqs.firehose_Scenario_PutRecords.end-->
67+
68+
69+
<!--custom.scenarios.firehose_Scenario_PutRecords.start-->
70+
<!--custom.scenarios.firehose_Scenario_PutRecords.end-->
71+
4572
### Tests
4673

4774
⚠ Running tests might result in charges to your AWS account.
@@ -68,4 +95,4 @@ in the `javav2` folder.
6895

6996
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7097

71-
SPDX-License-Identifier: Apache-2.0
98+
SPDX-License-Identifier: Apache-2.0

javav2/example_code/firehose/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
<groupId>software.amazon.awssdk</groupId>
5656
<artifactId>secretsmanager</artifactId>
5757
</dependency>
58+
<dependency>
59+
<groupId>software.amazon.awssdk</groupId>
60+
<artifactId>cloudwatch</artifactId>
61+
</dependency>
5862
<dependency>
5963
<groupId>com.google.code.gson</groupId>
6064
<artifactId>gson</artifactId>

javav2/example_code/firehose/src/main/java/com/example/firehose/CreateDeliveryStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static void main(String[] args) {
3636

3737
if (args.length != 3) {
3838
System.out.println(usage);
39-
System.exit(1);
39+
return;
4040
}
4141

4242
String bucketARN = args[0];
@@ -70,7 +70,6 @@ public static void createStream(FirehoseClient firehoseClient, String bucketARN,
7070

7171
} catch (FirehoseException e) {
7272
System.out.println(e.getLocalizedMessage());
73-
System.exit(1);
7473
}
7574
}
7675
}

javav2/example_code/firehose/src/main/java/com/example/firehose/DeleteStream.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void main(String[] args) {
3333

3434
if (args.length != 1) {
3535
System.out.println(usage);
36-
System.exit(1);
36+
return;
3737
}
3838

3939
String streamName = args[0];
@@ -57,7 +57,6 @@ public static void delStream(FirehoseClient firehoseClient, String streamName) {
5757

5858
} catch (FirehoseException e) {
5959
System.out.println(e.getLocalizedMessage());
60-
System.exit(1);
6160
}
6261
}
6362
}

javav2/example_code/firehose/src/main/java/com/example/firehose/ListDeliveryStreams.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public static void listStreams(FirehoseClient firehoseClient) {
4242

4343
} catch (FirehoseException e) {
4444
System.out.println(e.getLocalizedMessage());
45-
System.exit(1);
4645
}
4746
}
4847
}

javav2/example_code/firehose/src/main/java/com/example/firehose/PutBatchRecords.java

Lines changed: 0 additions & 107 deletions
This file was deleted.

javav2/example_code/firehose/src/main/java/com/example/firehose/PutRecord.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)