use of org.agrona.DirectBuffer in project zeebe by zeebe-io.
the class ControlMessageRequest method awaitError.
public ErrorResponse awaitError() {
try (ClientResponse response = responseFuture.join()) {
final ErrorResponse errorResponse = new ErrorResponse(msgPackHelper);
final DirectBuffer responseBuffer = response.getResponseBuffer();
errorResponse.wrap(responseBuffer, 0, responseBuffer.capacity());
return errorResponse;
}
}
use of org.agrona.DirectBuffer in project zeebe by zeebe-io.
the class ExecuteCommandRequest method awaitError.
public ErrorResponse awaitError() {
try (ClientResponse response = responseFuture.join()) {
final DirectBuffer responseBuffer = response.getResponseBuffer();
final ErrorResponse result = new ErrorResponse(msgPackHelper);
result.wrap(responseBuffer, 0, responseBuffer.capacity());
return result;
}
}
use of org.agrona.DirectBuffer in project zeebe by zeebe-io.
the class TopologyCreator method createTopology.
public Topology createTopology() {
LOG.trace("Received topology request.");
final Iterator<MemberRaftComposite> iterator = clusterManagerContext.getMemberListService().iterator();
final Topology topology = new Topology();
while (iterator.hasNext()) {
final MemberRaftComposite next = iterator.next();
final ValueArray<TopologyBroker> brokers = topology.brokers();
final SocketAddress clientApi = next.getClientApi();
if (clientApi != null) {
final TopologyBroker nextTopologyBroker = brokers.add();
nextTopologyBroker.setHost(clientApi.getHostBuffer(), 0, clientApi.hostLength()).setPort(clientApi.port());
final Iterator<RaftStateComposite> raftTupleIt = next.getRaftIterator();
while (raftTupleIt.hasNext()) {
final RaftStateComposite nextRaftState = raftTupleIt.next();
final DirectBuffer topicName = BufferUtil.cloneBuffer(nextRaftState.getTopicName());
nextTopologyBroker.partitionStates().add().setPartitionId(nextRaftState.getPartition()).setTopicName(topicName, 0, topicName.capacity()).setState(nextRaftState.getRaftState());
}
}
}
// LOG.debug("Send topology {} as response.", topology);
return topology;
}
use of org.agrona.DirectBuffer in project zeebe by zeebe-io.
the class RaftPersistentFileStorage method getMembers.
public List<SocketAddress> getMembers() {
final List<SocketAddress> members = new ArrayList<>();
final Iterator<RaftConfigurationMetadataMember> iterator = configuration.membersProp.iterator();
while (iterator.hasNext()) {
final RaftConfigurationMetadataMember member = iterator.next();
final DirectBuffer hostBuffer = member.getHost();
final SocketAddress socketAddress = new SocketAddress();
socketAddress.host(hostBuffer, 0, hostBuffer.capacity());
socketAddress.setPort(member.getPort());
members.add(socketAddress);
}
return members;
}
use of org.agrona.DirectBuffer in project zeebe by zeebe-io.
the class APISyncHandler method onSyncRequest.
@Override
public ActorFuture<Void> onSyncRequest(GossipSyncRequest request) {
return actor.call(() -> {
LOG.trace("Got API sync request.");
final Iterator<MemberRaftComposite> iterator = clusterManagerContext.getMemberListService().iterator();
while (iterator.hasNext()) {
final MemberRaftComposite next = iterator.next();
if (next.hasApis()) {
final DirectBuffer payload = writeAPIAddressesIntoBuffer(next.getManagementApi(), next.getReplicationApi(), next.getClientApi(), apiAddressBuffer);
request.addPayload(next.getMember(), payload);
}
}
LOG.trace("Send API sync response.");
});
}
Aggregations