Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Minor fix with SQS Message Binding #435

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
classes = {SpringwolfSqsExampleApplication.class},
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ExtendWith({SqsTestContainerExtension.class})
public class ApiIntegrationTest {
class ApiIntegrationTest {

@DynamicPropertySource
static void setUpTestContainers(DynamicPropertyRegistry registry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"$ref": "#/components/schemas/HeadersNotDocumented"
},
"bindings": {
"sqs": {
"bindingVersion": "0.2.0"
}
"sqs": { }
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.asyncapi.scanners.bindings.processor;

import com.asyncapi.v2.binding.message.amqp.AMQPMessageBinding;
import com.asyncapi.v2.binding.message.sqs.SQSMessageBinding;
import io.github.stavshamir.springwolf.asyncapi.scanners.bindings.MessageBindingProcessor;
import io.github.stavshamir.springwolf.asyncapi.scanners.bindings.ProcessedMessageBinding;
import io.github.stavshamir.springwolf.asyncapi.scanners.channels.operationdata.annotation.SqsAsyncOperationBinding;
Expand All @@ -23,15 +23,15 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) {
@Override
public Optional<ProcessedMessageBinding> process(Method method) {
return Arrays.stream(method.getAnnotations())
.filter(annotation -> annotation instanceof SqsAsyncOperationBinding)
.map(annotation -> (SqsAsyncOperationBinding) annotation)
.filter(SqsAsyncOperationBinding.class::isInstance)
.map(SqsAsyncOperationBinding.class::cast)
.findAny()
.map(this::mapToMessageBinding);
}

private ProcessedMessageBinding mapToMessageBinding(SqsAsyncOperationBinding bindingAnnotation) {
AMQPMessageBinding amqpMessageBinding = AMQPMessageBinding.builder().build();
SQSMessageBinding sqsMessageBinding = new SQSMessageBinding();

return new ProcessedMessageBinding(bindingAnnotation.type(), amqpMessageBinding);
return new ProcessedMessageBinding(bindingAnnotation.type(), sqsMessageBinding);
}
}