Skip to content

Commit

Permalink
Merge pull request #141 from mischwarz/main
Browse files Browse the repository at this point in the history
#140 supress Uni and Message
  • Loading branch information
ChMThiel authored Dec 12, 2023
2 parents ab03ee7 + ac318a9 commit 2719149
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

import io.quarkiverse.asyncapi.annotation.scanner.config.Channel;
import io.quarkiverse.asyncapi.annotation.scanner.kafka.binding.KafkaResolver;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;

/**
* @since 09.02.2023
Expand Down Expand Up @@ -273,10 +275,19 @@ public ChannelData(AnnotationInstance aAnnotationInstance, ResolveType aType) {
}
}

final Type resolveType(Type aFirstParameterType) {
return aFirstParameterType.kind().equals(PARAMETERIZED_TYPE)
? aFirstParameterType.asParameterizedType()
: aFirstParameterType;
final Type resolveType(Type aType) {
Type bType = aType;
if (DotName.createSimple(Uni.class).equals(aType.name())
|| DotName.createSimple(Multi.class).equals(aType.name())) {
bType = aType.asParameterizedType().arguments().get(0);
}
if (DotName.createSimple("org.eclipse.microprofile.reactive.messaging.Message").equals(bType.name())) {
bType = bType.asParameterizedType().arguments().get(0);
}
Type type = bType.kind().equals(PARAMETERIZED_TYPE)
? bType.asParameterizedType()
: bType;
return type;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

import org.eclipse.microprofile.reactive.messaging.Channel;
import org.eclipse.microprofile.reactive.messaging.Emitter;
import org.eclipse.microprofile.reactive.messaging.Incoming;
import org.eclipse.microprofile.reactive.messaging.Outgoing;
import org.eclipse.microprofile.reactive.messaging.*;
import org.reactivestreams.Publisher;

import io.quarkiverse.asyncapi.annotation.Schema;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import io.smallrye.reactive.messaging.annotations.Broadcast;

/**
Expand Down Expand Up @@ -66,6 +64,12 @@ public GecMessage<Part> sendMessageTyped() {
return null;
}

@Outgoing("outgoing-channel-reactive-part")
public Uni<Message<Part>> sendReactiveMessageTyped() {
//Do nothing
return null;
}

//Ignore internal channels that have no application.properties
@Channel("prices-intern")
Multi<Double> pricesIntern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ mp.messaging.outgoing.outgoing-channel-part.connector=smallrye-kafka
mp.messaging.outgoing.outgoing-channel-part.topic=outgoing-channel-part-topic
mp.messaging.outgoing.outgoing-channel-part.value.serializer=org.apache.kafka.common.serialization.StringSerializer

mp.messaging.outgoing.outgoing-channel-reactive-part.connector=smallrye-kafka
mp.messaging.outgoing.outgoing-channel-reactive-part.topic=outgoing-channel-reactive-part-topic
mp.messaging.outgoing.outgoing-channel-reactive-part.value.serializer=org.apache.kafka.common.serialization.StringSerializer

mp.messaging.incoming.prices.connector=smallrye-kafka

# Set root path to / (all resources - inclusive html pages are)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void shouldScanEmitterAnnotations() throws Exception {
assertThat(oneOfOpenApiNodeOneOf.get(0).get("type").asText()).isEqualTo("string");
assertThat(oneOfOpenApiNodeOneOf.get(1).get("type").asText()).isEqualTo("integer");

//Uni<Message<Part>>
assertThat(asyncAPI.at("/channels/outgoing-channel-reactive-part/publish/message/payload/$ref").asText())
.isEqualTo("#/components/schemas/Part");

//JsonGetter
assertThat(asyncAPI.at("/channels/channel-x/publish/message/payload/properties/i18n/description").asText())
.isNotEmpty();
Expand Down

0 comments on commit 2719149

Please sign in to comment.