-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into zell-clean-up-abstractions
- Loading branch information
Showing
50 changed files
with
900 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
broker/src/main/java/io/camunda/zeebe/broker/bootstrap/GatewayBrokerTransportStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.broker.bootstrap; | ||
|
||
import io.camunda.zeebe.scheduler.ConcurrencyControl; | ||
import io.camunda.zeebe.scheduler.future.ActorFuture; | ||
import io.camunda.zeebe.transport.impl.AtomixServerTransport; | ||
|
||
/** Starts the server transport which can receive commands from the gateway * */ | ||
final class GatewayBrokerTransportStep extends AbstractBrokerStartupStep { | ||
|
||
@Override | ||
public String getName() { | ||
return "Broker Transport"; | ||
} | ||
|
||
@Override | ||
void startupInternal( | ||
final BrokerStartupContext brokerStartupContext, | ||
final ConcurrencyControl concurrencyControl, | ||
final ActorFuture<BrokerStartupContext> startupFuture) { | ||
concurrencyControl.run(() -> startServerTransport(brokerStartupContext, startupFuture)); | ||
} | ||
|
||
@Override | ||
void shutdownInternal( | ||
final BrokerStartupContext brokerShutdownContext, | ||
final ConcurrencyControl concurrencyControl, | ||
final ActorFuture<BrokerStartupContext> shutdownFuture) { | ||
closeServerTransport(brokerShutdownContext, concurrencyControl, shutdownFuture); | ||
} | ||
|
||
private void startServerTransport( | ||
final BrokerStartupContext brokerStartupContext, | ||
final ActorFuture<BrokerStartupContext> startupFuture) { | ||
|
||
final var concurrencyControl = brokerStartupContext.getConcurrencyControl(); | ||
final var brokerInfo = brokerStartupContext.getBrokerInfo(); | ||
final var schedulingService = brokerStartupContext.getActorSchedulingService(); | ||
final var messagingService = brokerStartupContext.getApiMessagingService(); | ||
|
||
final var atomixServerTransport = | ||
new AtomixServerTransport(brokerInfo.getNodeId(), messagingService); | ||
|
||
concurrencyControl.runOnCompletion( | ||
schedulingService.submitActor(atomixServerTransport), | ||
proceed( | ||
() -> { | ||
brokerStartupContext.setGatewayBrokerTransport(atomixServerTransport); | ||
startupFuture.complete(brokerStartupContext); | ||
}, | ||
startupFuture)); | ||
} | ||
|
||
private void closeServerTransport( | ||
final BrokerStartupContext brokerShutdownContext, | ||
final ConcurrencyControl concurrencyControl, | ||
final ActorFuture<BrokerStartupContext> shutdownFuture) { | ||
final var serverTransport = brokerShutdownContext.getGatewayBrokerTransport(); | ||
|
||
if (serverTransport == null) { | ||
return; | ||
} | ||
|
||
concurrencyControl.runOnCompletion( | ||
serverTransport.closeAsync(), | ||
proceed( | ||
() -> { | ||
brokerShutdownContext.setGatewayBrokerTransport(null); | ||
shutdownFuture.complete(brokerShutdownContext); | ||
}, | ||
shutdownFuture)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.