diff --git a/springwolf-examples/springwolf-jms-example/src/main/java/io/github/springwolf/examples/jms/consumers/ExampleConsumer.java b/springwolf-examples/springwolf-jms-example/src/main/java/io/github/springwolf/examples/jms/consumers/ExampleConsumer.java index 7e728e59d..fc744ca8e 100644 --- a/springwolf-examples/springwolf-jms-example/src/main/java/io/github/springwolf/examples/jms/consumers/ExampleConsumer.java +++ b/springwolf-examples/springwolf-jms-example/src/main/java/io/github/springwolf/examples/jms/consumers/ExampleConsumer.java @@ -1,9 +1,14 @@ // SPDX-License-Identifier: Apache-2.0 package io.github.springwolf.examples.jms.consumers; +import io.github.springwolf.core.asyncapi.annotations.AsyncApiPayload; +import io.github.springwolf.core.asyncapi.annotations.AsyncListener; +import io.github.springwolf.core.asyncapi.annotations.AsyncMessage; +import io.github.springwolf.core.asyncapi.annotations.AsyncOperation; import io.github.springwolf.examples.jms.dtos.AnotherPayloadDto; import io.github.springwolf.examples.jms.dtos.ExamplePayloadDto; import io.github.springwolf.examples.jms.producers.AnotherProducer; +import io.github.springwolf.plugins.jms.asyncapi.annotations.JmsAsyncOperationBinding; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.jms.annotation.JmsListener; @@ -30,4 +35,70 @@ public void receiveExamplePayload(ExamplePayloadDto payload) { public void receiveAnotherPayload(AnotherPayloadDto payload) { log.info("Received new message in another-queue: {}", payload.toString()); } + + @AsyncListener( + operation = + @AsyncOperation( + channelName = "queue.in.x-to-me-feedback", + description = "X send the feedback to Me over this channel", // Optional + payloadType = String.class, + // payloadType = XFeedbackMessagePayload.class, + message = + @AsyncMessage( + name = "XFeedbackMessagePayload-CustomName", + messageId = "XFeedbackMessageId", + description = "Example feedback that X send to me", + title = "X send FEEDBACK to Me - Message"), + headers = + @AsyncOperation.Headers( + schemaName = "XToMeFeedbackHeaders", + values = { + @AsyncOperation.Headers.Header( + name = "headerFeedbackXToMe1", + value = "1", + description = "..headerFeedback XToMe1 description.."), + @AsyncOperation.Headers.Header( + name = "headerFeedbackXToMe2", + value = "2", + description = "..headerFeedback XToMe2 description.."), + }))) + @JmsAsyncOperationBinding + public void xSendFeedbackListenerFlow() { + // Flow logic + } + + record XFeedbackMessagePayload(@AsyncApiPayload String data) {} + + @AsyncListener( + operation = + @AsyncOperation( + channelName = "queue.in.x-to-me-data", + description = "X send the data to Me over this channel", // Optional + payloadType = String.class, + // payloadType = XDataMessagePayload.class, + message = + @AsyncMessage( + name = "XDataMessagePayload-CustomName", + messageId = "XDataMessageId", + description = "Example data message that X send to Me", + title = "X send DATA to Me - Message"), + headers = + @AsyncOperation.Headers( + schemaName = "XToMeDataHeaders", + values = { + @AsyncOperation.Headers.Header( + name = "headerDataXToMe1", + value = "1", + description = "..headerData XToMe1 description.."), + @AsyncOperation.Headers.Header( + name = "headerDataXToMe2", + value = "2", + description = "..headerData XToMe2 description.."), + }))) + @JmsAsyncOperationBinding + public void xSendDataListenerFlow() { + // Flow logic + } + + record XDataMessagePayload(@AsyncApiPayload String data) {} }