Skip to content

Commit 948cdae

Browse files
authored
JavaV2: JMS with SQS (#7314)
1 parent 3889a34 commit 948cdae

21 files changed

+1895
-2
lines changed

.doc_gen/metadata/sqs_metadata.yaml

+66-1
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ sqs_Scenario_TopicsAndQueues:
11161116
sqs_Scenario_WorkWithTags:
11171117
title: Work with queue tags and &SQS; using an &AWS; SDK
11181118
title_abbrev: Work with queue tags
1119-
synopsis: perform tagging operation with &SQS;
1119+
synopsis: perform tagging operation with &SQS;.
11201120
category: Scenarios
11211121
languages:
11221122
Java:
@@ -1130,3 +1130,68 @@ sqs_Scenario_WorkWithTags:
11301130
- sqs.java2.tag-examples
11311131
services:
11321132
sqs: {TagQueue, ListQueueTags, UntagQueue}
1133+
sqs_Scenario_UseJMS:
1134+
title: Use the &SQS; Java Messaging Library to work with the Java Message Service (JMS) interface for &SQS;
1135+
title_abbrev: Use the &SQS; Java Messaging Library to work with the JMS interface
1136+
synopsis: use the &SQS; Java Messaging Library to work with the JMS interface.
1137+
category: Scenarios
1138+
languages:
1139+
Java:
1140+
versions:
1141+
- sdk_version: 2
1142+
github: javav2/example_code/sqs
1143+
sdkguide:
1144+
excerpts:
1145+
- description: >-
1146+
The following examples work with standard &SQS; queues and include:</para>
1147+
<itemizedlist>
1148+
<listitem>
1149+
<para>Sending a text message.</para>
1150+
</listitem>
1151+
<listitem>
1152+
<para>Receiving messages synchronously.</para>
1153+
</listitem>
1154+
<listitem>
1155+
<para>Receiving messages asynchronously.</para>
1156+
</listitem>
1157+
<listitem>
1158+
<para>Receiving messages using CLIENT_ACKNOWLEDGE mode.</para>
1159+
</listitem>
1160+
<listitem>
1161+
<para>Receiving messages using the UNORDERED_ACKNOWLEDGE mode.</para>
1162+
</listitem>
1163+
<listitem>
1164+
<para>Using Spring to inject dependencies.</para>
1165+
</listitem>
1166+
<listitem>
1167+
<para>A utility class that provides common methods used by the other examples.</para>
1168+
</listitem>
1169+
</itemizedlist>
1170+
<para>For more information on using JMS with &SQS;, see the
1171+
<ulink type="documentation" url="AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-java-message-service-jms-client.html">&SQS; Developer Guide</ulink>.
1172+
</para><para>Sending a text message.
1173+
snippet_tags:
1174+
- sqs-jms.java2.send-text-message
1175+
- description: Receiving messages synchronously.
1176+
snippet_tags:
1177+
- sqs-jms.java2.receive-message-sync
1178+
- description: Receiving messages asynchronously.
1179+
snippet_tags:
1180+
- sqs-jms.java2.receive-message-async
1181+
- description: Receiving messages using CLIENT_ACKNOWLEDGE mode.
1182+
snippet_tags:
1183+
- sqs-jms.java2.receive-message-sync-client-ack
1184+
- description: Receiving messages using the UNORDERED_ACKNOWLEDGE mode.
1185+
snippet_tags:
1186+
- sqs-jms.java2.receive-message-sync-unordered-ack
1187+
- description: Using Spring to inject dependencies.
1188+
snippet_tags:
1189+
- sqs-jms.java2.spring
1190+
- description: Spring bean definitions.
1191+
snippet_files:
1192+
- javav2/example_code/sqs-jms/src/main/resources/SpringExampleConfiguration.xml.txt
1193+
- description: A utility class that provides common methods used by the other examples.
1194+
snippet_files:
1195+
- javav2/example_code/sqs-jms/src/main/java/com/example/sqs/jms/SqsJmsExampleUtils.java
1196+
services:
1197+
sqs: {CreateQueue, DeleteQueue}

javav2/example_code/sqs-jms/pom.xml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>SQSJMSJ2Project</groupId>
7+
<artifactId>SQSJMSJ2Project</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<java.version>17</java.version>
12+
<maven.compiler.target>17</maven.compiler.target>
13+
<maven.compiler.source>17</maven.compiler.source>
14+
</properties>
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.apache.maven.plugins</groupId>
19+
<artifactId>maven-surefire-plugin</artifactId>
20+
<version>3.5.2</version>
21+
</plugin>
22+
<plugin>
23+
<groupId>org.apache.maven.plugins</groupId>
24+
<artifactId>maven-compiler-plugin</artifactId>
25+
<version>3.1</version>
26+
<configuration>
27+
<source>${java.version}</source>
28+
<target>${java.version}</target>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</build>
33+
<dependencyManagement>
34+
<dependencies>
35+
<dependency>
36+
<groupId>software.amazon.awssdk</groupId>
37+
<artifactId>bom</artifactId>
38+
<version>2.29.24</version>
39+
<type>pom</type>
40+
<scope>import</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.apache.logging.log4j</groupId>
44+
<artifactId>log4j-bom</artifactId>
45+
<version>2.23.1</version>
46+
<type>pom</type>
47+
<scope>import</scope>
48+
</dependency>
49+
</dependencies>
50+
</dependencyManagement>
51+
<dependencies>
52+
<dependency>
53+
<groupId>com.amazonaws</groupId>
54+
<artifactId>amazon-sqs-java-messaging-lib</artifactId>
55+
<version>2.1.4</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>software.amazon.awssdk</groupId>
59+
<artifactId>sso</artifactId>
60+
</dependency>
61+
<dependency>
62+
<groupId>software.amazon.awssdk</groupId>
63+
<artifactId>ssooidc</artifactId>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.apache.logging.log4j</groupId>
67+
<artifactId>log4j-core</artifactId>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.slf4j</groupId>
71+
<artifactId>slf4j-api</artifactId>
72+
<version>2.0.13</version>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.apache.logging.log4j</groupId>
76+
<artifactId>log4j-slf4j2-impl</artifactId>
77+
</dependency>
78+
<dependency>
79+
<groupId>org.apache.logging.log4j</groupId>
80+
<artifactId>log4j-1.2-api</artifactId>
81+
</dependency>
82+
<!-- Spring Core and Context (Needed for XML-based configuration) -->
83+
<dependency>
84+
<groupId>org.springframework</groupId>
85+
<artifactId>spring-context</artifactId>
86+
<version>6.1.14</version> <!-- Use the latest compatible version -->
87+
</dependency>
88+
89+
<!-- Spring Beans (Required for bean configuration) -->
90+
<dependency>
91+
<groupId>org.springframework</groupId>
92+
<artifactId>spring-beans</artifactId>
93+
<version>6.1.14</version>
94+
</dependency>
95+
96+
<!-- Spring Core (Provides core utilities) -->
97+
<dependency>
98+
<groupId>org.springframework</groupId>
99+
<artifactId>spring-core</artifactId>
100+
<version>6.1.14</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.junit.jupiter</groupId>
104+
<artifactId>junit-jupiter-engine</artifactId>
105+
<version>5.12.0</version>
106+
<scope>test</scope>
107+
</dependency>
108+
109+
<!-- Adding the apache-client compile-time dependency in order to exclude commons-logging.
110+
This exclusion stops this statement emitted by Spring:
111+
"Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts" -->
112+
<dependency>
113+
<groupId>software.amazon.awssdk</groupId>
114+
<artifactId>apache-client</artifactId>
115+
<exclusions>
116+
<exclusion>
117+
<groupId>commons-logging</groupId>
118+
<artifactId>commons-logging</artifactId>
119+
</exclusion>
120+
</exclusions>
121+
</dependency>
122+
123+
</dependencies>
124+
</project>

0 commit comments

Comments
 (0)