Package io.micronaut.gcp.pubsub.support
Class PubSubPublisherState
- java.lang.Object
-
- io.micronaut.gcp.pubsub.support.PubSubPublisherState
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class PubSubPublisherState extends java.lang.Object implements java.lang.AutoCloseable
Stores the context of a PubSubMessage to be pulished. Values of this class comes from parsing of method annotations and hence are cached @seePubSubConsumerAdvice
- Since:
- 2.0.0
- Author:
- Vinicius Carvalho
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PubSubPublisherState.TopicState
Internal class to represent Topic State.
-
Constructor Summary
Constructors Constructor Description PubSubPublisherState(PubSubPublisherState.TopicState topicState, java.util.Map<java.lang.String,java.lang.String> staticMessageAttributes, io.micronaut.core.type.Argument<?> bodyArgument, com.google.cloud.pubsub.v1.PublisherInterface publisher, java.util.Optional<io.micronaut.core.type.Argument> orderingArgument)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
io.micronaut.core.type.Argument<?>
getBodyArgument()
java.util.Optional<io.micronaut.core.type.Argument>
getOrderingArgument()
com.google.cloud.pubsub.v1.PublisherInterface
getPublisher()
java.util.Map<java.lang.String,java.lang.String>
getStaticMessageAttributes()
PubSubPublisherState.TopicState
getTopicState()
-
-
-
Constructor Detail
-
PubSubPublisherState
public PubSubPublisherState(PubSubPublisherState.TopicState topicState, java.util.Map<java.lang.String,java.lang.String> staticMessageAttributes, io.micronaut.core.type.Argument<?> bodyArgument, com.google.cloud.pubsub.v1.PublisherInterface publisher, java.util.Optional<io.micronaut.core.type.Argument> orderingArgument)
-
-
Method Detail
-
getPublisher
public com.google.cloud.pubsub.v1.PublisherInterface getPublisher()
- Returns:
- the cached publisher associated with the method.
-
getTopicState
public PubSubPublisherState.TopicState getTopicState()
- Returns:
- topicState information
-
getStaticMessageAttributes
public java.util.Map<java.lang.String,java.lang.String> getStaticMessageAttributes()
- Returns:
- Message Attributes from Header annotations
-
getBodyArgument
public io.micronaut.core.type.Argument<?> getBodyArgument()
- Returns:
- the body argument
-
getOrderingArgument
public java.util.Optional<io.micronaut.core.type.Argument> getOrderingArgument()
- Returns:
- Argument annotated with @
OrderingKey
.
-
close
public void close() throws java.lang.Exception
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
-
-