Interface MessagingProvider
public interface MessagingProvider
Messaging abstraction for a journal based messaging like Apache Kafka.
Messages are represented as json serialisable java classes.
The API assumes that each MessagingProvider is mapped to exactly one partition,
so positions in a topic can be represented as a single long offset.
-
Method Summary
Modifier and TypeMethodDescriptionvoidassertTopic(String topic) Validate that a topic is suitably set up for the messaging implementationassignTo(long offset) Create assign String to feed into poller based on a given offset.Get assign String to feed into createPoller based on either earliest or latest and a relative offset.default CloseablecreatePoller(String topicName, Reset reset, String assign, Map<String, String> filterProperties, HandlerAdapter<?>... adapters) Create a poller which listens to a topic and starts at a given reset or assigned offset.createPoller(String topicName, Reset reset, String assign, HandlerAdapter<?>... adapters) Create a poller which listens to a topic and starts at a given reset or assigned offset.default CloseablecreatePoller(String topicName, Reset reset, HandlerAdapter<?>... adapters) <T> MessageSender<T> createSender(String topic) Create sender for a specific topicReturn the uri of the messaging system backend.longretrieveOffset(String topicName, Reset reset) Retrieve earliest or latest offset for a topic
-
Method Details
-
createSender
Create sender for a specific topic- Type Parameters:
T- type of the message- Parameters:
topic- topic name- Returns:
- sender
-
createPoller
-
createPoller
Create a poller which listens to a topic and starts at a given reset or assigned offset.- Parameters:
topicName- name of the topicreset- fallback in case no assign is given or the assigned offset not validassign- opaque implementation dependent assign string (can be null)adapters- list of listener adapters- Returns:
- closeable handle of the poller
-
createPoller
default Closeable createPoller(String topicName, Reset reset, String assign, Map<String, String> filterProperties, HandlerAdapter<?>... adapters) Create a poller which listens to a topic and starts at a given reset or assigned offset.- Parameters:
topicName- name of the topicreset- fallback in case no assign is given or the assigned offset not validassign- opaque implementation dependent assign string (can be null)filterProperties- List of properties used to filter the topic messages. Only messages that match all filterProperties keys and values will be received.adapters- list of listener adapters- Returns:
- closeable handle of the poller
-
assertTopic
Validate that a topic is suitably set up for the messaging implementation- Parameters:
topic- topic name- Throws:
MessagingException- exception in case the topic is not suitable
-
retrieveOffset
Retrieve earliest or latest offset for a topic- Parameters:
topicName- name of the topicreset- latest or earliest- Returns:
- offset
-
assignTo
Create assign String to feed into poller based on a given offset. The inner format of the assign string is implementation specific.- Parameters:
offset-- Returns:
- assign String
-
assignTo
Get assign String to feed into createPoller based on either earliest or latest and a relative offset. The inner format of the assign string is implementation specific.- Parameters:
reset- reference pointrelativeOffset- relative offset- Returns:
- assign String
-
getServerUri
URI getServerUri()Return the uri of the messaging system backend. The uri must be unique regarding the validity of per topic offsets.- Returns:
- uri
-