use of com.hazelcast.topic.impl.reliable.ReliableTopicMessage in project hazelcast by hazelcast.
the class ClientReliableTopicProxy method publish.
@Override
public void publish(E payload) {
try {
Data data = serializationService.toData(payload);
ReliableTopicMessage message = new ReliableTopicMessage(data, null);
switch(overloadPolicy) {
case ERROR:
addOrFail(message);
break;
case DISCARD_OLDEST:
addOrOverwrite(message);
break;
case DISCARD_NEWEST:
ringbuffer.addAsync(message, OverflowPolicy.FAIL).get();
break;
case BLOCK:
addWithBackoff(message);
break;
default:
throw new IllegalArgumentException("Unknown overloadPolicy:" + overloadPolicy);
}
} catch (Exception e) {
throw (RuntimeException) peel(e, null, "Failed to publish message: " + payload + " to topic:" + getName());
}
}
Aggregations