Search in sources :

Example 86 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class ClusterMemberListManager method onOpenLogStreamService.

@Override
public void onOpenLogStreamService(LogStream logStream) {
    final int partitionId = logStream.getPartitionId();
    final DirectBuffer savedTopicName = BufferUtil.cloneBuffer(logStream.getTopicName());
    actor.call(() -> updateTopologyOnRaftStateChangeForPartition(LEADER, partitionId, savedTopicName));
}
Also used : DirectBuffer(org.agrona.DirectBuffer)

Example 87 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class ClusterMemberListManager method publishNodeAPIAddresses.

public void publishNodeAPIAddresses() {
    final Gossip gossip = context.getGossip();
    final String defaultHost = transportComponentCfg.host;
    final DirectBuffer payload = writeAPIAddressesIntoBuffer(transportComponentCfg.managementApi.toSocketAddress(defaultHost), transportComponentCfg.replicationApi.toSocketAddress(defaultHost), transportComponentCfg.clientApi.toSocketAddress(defaultHost), apiAddressBuffer);
    gossip.publishEvent(API_EVENT_TYPE, payload);
}
Also used : DirectBuffer(org.agrona.DirectBuffer) Gossip(io.zeebe.gossip.Gossip)

Example 88 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class RemoveTopicSubscriptionHandler method handle.

@Override
public void handle(final ActorControl actor, final int partitionId, final DirectBuffer buffer, final BrokerEventMetadata metadata) {
    final int requestStreamId = metadata.getRequestStreamId();
    final long requestId = metadata.getRequestId();
    final CloseSubscriptionRequest request = new CloseSubscriptionRequest();
    request.wrap(cloneBuffer(buffer));
    final ActorFuture<Void> future = subscriptionService.closeSubscriptionAsync(partitionId, request.getSubscriberKey());
    actor.runOnCompletion(future, ((aVoid, throwable) -> {
        if (throwable == null) {
            sendResponse(actor, requestStreamId, requestId, request);
        } else {
            sendErrorResponse(actor, requestStreamId, requestId, "Cannot close topic subscription. %s", throwable.getMessage());
        }
    }));
}
Also used : AbstractControlMessageHandler(io.zeebe.broker.transport.controlmessage.AbstractControlMessageHandler) ActorControl(io.zeebe.util.sched.ActorControl) ActorFuture(io.zeebe.util.sched.future.ActorFuture) BrokerEventMetadata(io.zeebe.protocol.impl.BrokerEventMetadata) TopicSubscriptionService(io.zeebe.broker.event.processor.TopicSubscriptionService) ControlMessageType(io.zeebe.protocol.clientapi.ControlMessageType) ServerOutput(io.zeebe.transport.ServerOutput) BufferUtil.cloneBuffer(io.zeebe.util.buffer.BufferUtil.cloneBuffer) CloseSubscriptionRequest(io.zeebe.broker.event.processor.CloseSubscriptionRequest) DirectBuffer(org.agrona.DirectBuffer) CloseSubscriptionRequest(io.zeebe.broker.event.processor.CloseSubscriptionRequest)

Example 89 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class ControlMessageRequest method await.

public ControlMessageResponse await() {
    try (ClientResponse response = responseFuture.join()) {
        final DirectBuffer responseBuffer = response.getResponseBuffer();
        final ControlMessageResponse result = new ControlMessageResponse(msgPackHelper);
        result.wrap(responseBuffer, 0, responseBuffer.capacity());
        return result;
    }
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer) DirectBuffer(org.agrona.DirectBuffer)

Example 90 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class ExecuteCommandRequest method await.

public ExecuteCommandResponse await() {
    try (ClientResponse response = responseFuture.join()) {
        final DirectBuffer responseBuffer = response.getResponseBuffer();
        final ExecuteCommandResponse result = new ExecuteCommandResponse(msgPackHelper);
        result.wrap(responseBuffer, 0, responseBuffer.capacity());
        return result;
    }
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer) DirectBuffer(org.agrona.DirectBuffer)

Aggregations

DirectBuffer (org.agrona.DirectBuffer)116 Header (io.aeron.logbuffer.Header)21 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)21 MutableDirectBuffer (org.agrona.MutableDirectBuffer)20 File (java.io.File)19 MediaDriver (io.aeron.driver.MediaDriver)18 CountersReader (org.agrona.concurrent.status.CountersReader)15 ThreadingMode (io.aeron.driver.ThreadingMode)12 FragmentHandler (io.aeron.logbuffer.FragmentHandler)12 MappedByteBuffer (java.nio.MappedByteBuffer)12 ClusteredService (io.aeron.cluster.service.ClusteredService)10 InterruptAfter (io.aeron.test.InterruptAfter)10 Test (org.junit.jupiter.api.Test)10 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 Publication (io.aeron.Publication)9 ClientSession (io.aeron.cluster.service.ClientSession)9 ClusteredServiceContainer (io.aeron.cluster.service.ClusteredServiceContainer)8 Assertions (org.junit.jupiter.api.Assertions)8 Mockito.mock (org.mockito.Mockito.mock)8