Class DefaultSchemaHandler
java.lang.Object
io.micronaut.pulsar.processor.DefaultSchemaHandler
Message type resolver for Pulsar schema. Simplifies resolving Java types to Pulsar schemas by using requested
transmission type via annotations and injecting proper resolvers in place.
- Since:
- 1.1.0
- Author:
- Haris Secic
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> bodyType(io.micronaut.core.type.Argument<?> body) org.apache.pulsar.client.api.Schema<?> decideSchema(io.micronaut.core.type.Argument<?> body, @Nullable io.micronaut.core.type.Argument<?> key, io.micronaut.core.annotation.AnnotationValue<?> topicAnnotation, String target) Resolve which schema to use for ser/der.
-
Constructor Details
-
DefaultSchemaHandler
public DefaultSchemaHandler(io.micronaut.context.BeanContext context) - Parameters:
context- BeanContext for fetching extra resolvers- Since:
- 1.1.0
-
-
Method Details
-
decideSchema
public org.apache.pulsar.client.api.Schema<?> decideSchema(io.micronaut.core.type.Argument<?> body, @Nullable io.micronaut.core.type.Argument<?> key, io.micronaut.core.annotation.AnnotationValue<?> topicAnnotation, String target) Resolve which schema to use for ser/der.- Parameters:
body- argument that represents message bodykey- if message is of type key-value a key should be passed; otherwise use nulltopicAnnotation- annotation corresponding to one of the Pulsar annotations: consumer, reader, producer.target- name of the method, field, or other that represent where the error might be in case of it.- Returns:
- new Schema
-
bodyType
-