Skip to content

Commit

Permalink
add message handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenischev committed Feb 7, 2024
1 parent a73c1ef commit 6723e88
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Service;
{%- if asyncapi | isProtocol('ws') and hasPublish %}
import org.springframework.messaging.handler.annotation.MessageMapping;
{%- endif %}
{%- if asyncapi | isProtocol('kafka') and hasPublish %}
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.KafkaHeaders;
Expand Down Expand Up @@ -115,6 +118,11 @@ public class MessageHandlerService {
// parametrized listener
}
{%- endif %}
{% elif asyncapi | isProtocol('ws') %}
@MessageMapping("/{{channelName}}")
public void handle{{methodName | upperFirst}}({{typeName}} payload) {
LOGGER.info("Message received from {{- channelName -}} : " + payload);
}
{%- else %}
{%- if hasParameters %}
@Value("${mqtt.topic.{{-methodName-}}}")
Expand Down

0 comments on commit 6723e88

Please sign in to comment.