Class OnapMsgRouterBatchPublisher
- java.lang.Object
-
- io.continual.onap.services.publisher.OnapMsgRouterBatchPublisher
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class OnapMsgRouterBatchPublisher extends Object implements Closeable
A batching publisher for ONAP Message Router.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOnapMsgRouterBatchPublisher.Builderstatic classOnapMsgRouterBatchPublisher.DropPolicyWhat to do if the send buffer reaches maximum capacity
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.OnapMsgRouterBatchPublishersend(OnapMsgRouterPublisher.Message msg)Queue a message to be sent in a batch.OnapMsgRouterBatchPublishersend(List<OnapMsgRouterPublisher.Message> msgs)Queue a set of messages to be sent in a batch.voidstart()Start the sending thread
-
-
-
Method Detail
-
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
public OnapMsgRouterBatchPublisher send(OnapMsgRouterPublisher.Message msg)
Queue a message to be sent in a batch.- Parameters:
msg- a message to send- Returns:
- this
-
send
public OnapMsgRouterBatchPublisher send(List<OnapMsgRouterPublisher.Message> msgs)
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
-
-