Class OnapMsgRouterBatchPublisher
java.lang.Object
io.continual.onap.services.publisher.OnapMsgRouterBatchPublisher
- All Implemented Interfaces:
Closeable,AutoCloseable
A batching publisher for ONAP Message Router.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumWhat to do if the send buffer reaches maximum capacity -
Method Summary
Modifier and TypeMethodDescriptionstatic OnapMsgRouterBatchPublisherbuild(OnapMsgRouterPublisher pub, int atMost, int maxAgeMs) For convenience, just provide a publisher and batching limitsvoidclose()Close this publisher to stop its background sending thread.Queue a message to be sent in a batch.Queue a set of messages to be sent in a batch.voidstart()Start the sending thread
-
Method Details
-
build
public static OnapMsgRouterBatchPublisher build(OnapMsgRouterPublisher pub, int atMost, int maxAgeMs) For convenience, just provide a publisher and batching limits- Parameters:
pub- an underlying publisheratMost- how many messages to batch, at mostmaxAgeMs- how long to wait before send, at most- Returns:
- a batch publisher
-
start
public void start()Start the sending thread -
close
public void close()Close this publisher to stop its background sending thread.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
send
Queue a message to be sent in a batch.- Parameters:
msg- a message to send- Returns:
- this
-
send
Queue a set of messages to be sent in a batch. Iteration order is preserved in the send.- Parameters:
msgs- a list of messages to send- Returns:
- this
-