Skip to content

Commit 21c363d

Browse files
Fix ConnectEvent::queue field to have the correct fields
Fixes ConnectEvent to use a proper Queue with name and arn fields according to the implementation of sibling packages and the relevant aws documentation.
1 parent 95dc035 commit 21c363d

File tree

9 files changed

+39
-9
lines changed

9 files changed

+39
-9
lines changed

aws-lambda-java-events-sdk-transformer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<dependency>
6464
<groupId>com.amazonaws</groupId>
6565
<artifactId>aws-lambda-java-events</artifactId>
66-
<version>3.11.2</version>
66+
<version>3.16.1</version>
6767
<scope>provided</scope>
6868
</dependency>
6969

aws-lambda-java-events/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.amazonaws</groupId>
77
<artifactId>aws-lambda-java-events</artifactId>
8-
<version>3.16.0</version>
8+
<version>3.16.1</version>
99
<packaging>jar</packaging>
1010

1111
<name>AWS Lambda Java Events Library</name>

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConnectEvent.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static class ContactData implements Serializable, Cloneable {
5959
private String initiationMethod;
6060
private String instanceArn;
6161
private String previousContactId;
62-
private String queue;
62+
private Queue queue;
6363
private SystemEndpoint systemEndpoint;
6464
}
6565

@@ -80,4 +80,13 @@ public static class SystemEndpoint implements Serializable, Cloneable {
8080
private String address;
8181
private String type;
8282
}
83+
@Data
84+
@Builder(setterPrefix = "with")
85+
@NoArgsConstructor
86+
@AllArgsConstructor
87+
public static class Queue implements Serializable, Cloneable {
88+
private String name;
89+
private String ARN;
90+
}
91+
8392
}

aws-lambda-java-serialization/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.amazonaws</groupId>
66
<artifactId>aws-lambda-java-serialization</artifactId>
7-
<version>1.1.5</version>
7+
<version>1.1.6</version>
88
<packaging>jar</packaging>
99

1010
<name>AWS Lambda Java Runtime Serialization</name>

aws-lambda-java-serialization/src/main/java/com/amazonaws/services/lambda/runtime/serialization/events/LambdaEventSerializers.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public class LambdaEventSerializers {
118118
ConnectEventMixin.ContactDataMixin.class),
119119
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.ConnectEvent$CustomerEndpoint",
120120
ConnectEventMixin.CustomerEndpointMixin.class),
121+
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.ConnectEvent$Queue", ConnectEventMixin.QueueMixin.class),
121122
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.ConnectEvent$SystemEndpoint",
122123
ConnectEventMixin.SystemEndpointMixin.class),
123124
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.DynamodbEvent",
@@ -170,6 +171,7 @@ public class LambdaEventSerializers {
170171
new NestedClass("com.amazonaws.services.lambda.runtime.events.ConnectEvent$Details"),
171172
new NestedClass("com.amazonaws.services.lambda.runtime.events.ConnectEvent$ContactData"),
172173
new NestedClass("com.amazonaws.services.lambda.runtime.events.ConnectEvent$CustomerEndpoint"),
174+
new NestedClass("com.amazonaws.services.lambda.runtime.events.ConnectEvent$Queue"),
173175
new NestedClass("com.amazonaws.services.lambda.runtime.events.ConnectEvent$SystemEndpoint"))),
174176
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.DynamodbEvent",
175177
Arrays.asList(
@@ -214,7 +216,10 @@ public class LambdaEventSerializers {
214216
*/
215217
private static final Map<String, PropertyNamingStrategy> NAMING_STRATEGY_MAP = Stream.of(
216218
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.SNSEvent",
217-
new PropertyNamingStrategy.PascalCaseStrategy()))
219+
new PropertyNamingStrategy.PascalCaseStrategy()),
220+
new SimpleEntry<>("com.amazonaws.services.lambda.runtime.events.ConnectEvent$Queue",
221+
new PropertyNamingStrategy.PascalCaseStrategy())
222+
)
218223
.collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue));
219224

220225
/**

aws-lambda-java-serialization/src/main/java/com/amazonaws/services/lambda/runtime/serialization/events/mixins/ConnectEventMixin.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public abstract class ContactDataMixin {
6565
@JsonProperty("PreviousContactId") abstract void setPreviousContactId(String previousContactId);
6666

6767
// needed because Jackson expects "queue" instead of "Queue"
68-
@JsonProperty("Queue") abstract String getQueue();
69-
@JsonProperty("Queue") abstract void setQueue(String queue);
68+
@JsonProperty("Queue") abstract Map<String, String> getQueue();
69+
@JsonProperty("Queue") abstract void setQueue(Map<String, String> queue);
7070

7171
// needed because Jackson expects "systemEndpoint" instead of "SystemEndpoint"
7272
@JsonProperty("SystemEndpoint") abstract Map<String,String> getSystemEndpoint();
@@ -95,4 +95,9 @@ public abstract class SystemEndpointMixin {
9595
@JsonProperty("Type") abstract String getType();
9696
@JsonProperty("Type") abstract void setType(String type);
9797
}
98+
99+
public abstract class QueueMixin {
100+
@JsonProperty("Name") abstract String getName();
101+
@JsonProperty("Name") abstract void setName(String name);
102+
}
98103
}

aws-lambda-java-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<dependency>
4646
<groupId>com.amazonaws</groupId>
4747
<artifactId>aws-lambda-java-events</artifactId>
48-
<version>3.16.0</version>
48+
<version>3.16.1</version>
4949
</dependency>
5050
<dependency>
5151
<groupId>org.junit.jupiter</groupId>

aws-lambda-java-tests/src/test/java/com/amazonaws/services/lambda/runtime/tests/EventLoaderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@ public void testLoadConnectEvent() {
333333
assertThat(contactData.getSystemEndpoint())
334334
.returns("+21234567890",from(ConnectEvent.SystemEndpoint::getAddress))
335335
.returns("TELEPHONE_NUMBER",from(ConnectEvent.SystemEndpoint::getType));
336+
337+
assertThat(contactData.getQueue())
338+
.isNotNull()
339+
.returns("SampleQueue", from(ConnectEvent.Queue::getName))
340+
.returns("arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa",
341+
from(ConnectEvent.Queue::getARN)
342+
);
343+
336344
}
337345

338346
@Test

aws-lambda-java-tests/src/test/resources/connect_event.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
}
2323
},
2424
"PreviousContactId": "4ca32fbd-8f92-46af-92a5-6b0f970f0efe",
25-
"Queue": null,
25+
"Queue": {
26+
"Name": "SampleQueue",
27+
"ARN": "arn:aws:connect:eu-central-1:123456789012:instance/9308c2a1-9bc6-4cea-8290-6c0b4a6d38fa"
28+
},
2629
"SystemEndpoint": {
2730
"Address": "+21234567890",
2831
"Type": "TELEPHONE_NUMBER"

0 commit comments

Comments
 (0)