Search in sources :

Example 6 with PublishRequest

use of io.atomix.protocols.raft.protocol.PublishRequest in project atomix by atomix.

the class RaftSession method sendEvents.

/**
 * Sends an event to the session.
 */
private void sendEvents(EventHolder event) {
    // Only send events to the client if this server is the leader.
    if (server.isLeader()) {
        eventExecutor.execute(() -> {
            PublishRequest request = PublishRequest.builder().withSession(sessionId().id()).withEventIndex(event.eventIndex).withPreviousIndex(event.previousIndex).withEvents(event.events).build();
            log.trace("Sending {}", request);
            protocol.publish(member, request);
        });
    }
}
Also used : PublishRequest(io.atomix.protocols.raft.protocol.PublishRequest)

Aggregations

PublishRequest (io.atomix.protocols.raft.protocol.PublishRequest)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 Test (org.junit.Test)5 CommandResponse (io.atomix.protocols.raft.protocol.CommandResponse)4