Package org.opennms.core.ipc.twin.common
Class AbstractTwinPublisher
- java.lang.Object
-
- org.opennms.core.ipc.twin.common.AbstractTwinPublisher
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,TwinPublisher
- Direct Known Subclasses:
GrpcTwinPublisher
,JmsTwinPublisher
,KafkaTwinPublisher
public abstract class AbstractTwinPublisher extends java.lang.Object implements TwinPublisher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTwinPublisher.SessionKey
-
Nested classes/interfaces inherited from interface org.opennms.core.ipc.twin.api.TwinPublisher
TwinPublisher.Session<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.ObjectMapper
objectMapper
-
Constructor Summary
Constructors Constructor Description AbstractTwinPublisher(LocalTwinSubscriber localTwinSubscriber)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
forEachSession(java.util.function.BiConsumer<AbstractTwinPublisher.SessionKey,TwinTracker> consumer)
protected TwinUpdate
getTwin(TwinRequest twinRequest)
protected abstract void
handleSinkUpdate(TwinUpdate sinkUpdate)
protected TwinRequest
mapTwinRequestProto(byte[] twinRequestBytes)
protected TwinResponseProto
mapTwinResponse(TwinUpdate twinUpdate)
<T> TwinPublisher.Session<T>
register(java.lang.String key, java.lang.Class<T> clazz, java.lang.String location)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.core.ipc.twin.api.TwinPublisher
register
-
-
-
-
Constructor Detail
-
AbstractTwinPublisher
public AbstractTwinPublisher(LocalTwinSubscriber localTwinSubscriber)
-
-
Method Detail
-
handleSinkUpdate
protected abstract void handleSinkUpdate(TwinUpdate sinkUpdate)
- Parameters:
sinkUpdate
- Handle sink Update from @AbstractTwinPublisher
.
-
register
public <T> TwinPublisher.Session<T> register(java.lang.String key, java.lang.Class<T> clazz, java.lang.String location) throws java.io.IOException
- Specified by:
register
in interfaceTwinPublisher
- Type Parameters:
T
- type of object for replication- Parameters:
key
- unique key for the object.clazz
- a class used for serialization.location
- targeted Minion location for the object, set null for all locations.- Returns:
- Session which provides updates to object.
- Throws:
java.io.IOException
-
getTwin
protected TwinUpdate getTwin(TwinRequest twinRequest)
-
mapTwinResponse
protected TwinResponseProto mapTwinResponse(TwinUpdate twinUpdate)
-
mapTwinRequestProto
protected TwinRequest mapTwinRequestProto(byte[] twinRequestBytes)
-
forEachSession
public void forEachSession(java.util.function.BiConsumer<AbstractTwinPublisher.SessionKey,TwinTracker> consumer)
-
-