Skip to content

Commit

Permalink
Remove leftover configuration in *.conf files and no longer needed Up…
Browse files Browse the repository at this point in the history
…datedConnectionTester

Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed Sep 2, 2022
1 parent 627ca6b commit d5bfcc2
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import static org.eclipse.ditto.base.model.common.ConditionChecker.checkNotNull;
import static org.eclipse.ditto.connectivity.api.ConnectivityMessagingConstants.CLUSTER_ROLE;

import java.net.URI;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.Instant;
Expand Down Expand Up @@ -59,7 +57,6 @@
import org.eclipse.ditto.connectivity.model.signals.commands.modify.CheckConnectionLogsActive;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.CloseConnection;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.EnableConnectionLogs;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.ModifyConnection;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.OpenConnection;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.TestConnection;
import org.eclipse.ditto.connectivity.model.signals.commands.modify.TestConnectionResponse;
Expand Down Expand Up @@ -196,8 +193,6 @@ public final class ConnectionPersistenceActor
@Nullable private Integer priority;
@Nullable private Instant recoveredAt;

private final UpdatedConnectionTester updatedConnectionTester;

ConnectionPersistenceActor(final ConnectionId connectionId,
final ActorRef commandForwarderActor,
final ActorRef pubSubMediator,
Expand All @@ -208,7 +203,6 @@ public final class ConnectionPersistenceActor
final ActorSystem actorSystem = context().system();
cluster = Cluster.get(actorSystem);
final Config dittoExtensionConfig = ScopedConfig.dittoExtension(actorSystem.settings().config());
this.updatedConnectionTester = UpdatedConnectionTester.get(actorSystem, dittoExtensionConfig);
this.commandForwarderActor = commandForwarderActor;
propsFactory = ClientActorPropsFactory.get(actorSystem, dittoExtensionConfig);
this.pubSubMediator = pubSubMediator;
Expand Down Expand Up @@ -621,10 +615,10 @@ private void interpretStagedCommand(final StagedCommand command) {
passivate();
break;
case OPEN_CONNECTION:
openConnection(command.next(), false, false);
openConnection(command.next(), false);
break;
case OPEN_CONNECTION_IGNORE_ERRORS:
openConnection(command.next(), true, false);
openConnection(command.next(), true);
break;
case CLOSE_CONNECTION:
closeConnection(command.next());
Expand Down Expand Up @@ -839,28 +833,17 @@ private void setConnectionStatusClosedForTestConnection() {
}
}

private void openConnection(final StagedCommand command, final boolean ignoreErrors, final boolean retry) {
private void openConnection(final StagedCommand command, final boolean ignoreErrors) {
final OpenConnection openConnection = OpenConnection.of(entityId, command.getDittoHeaders());
final Consumer<Object> successConsumer = response -> getSelf().tell(command, ActorRef.noSender());
startAndAskClientActors(openConnection, getClientCount())
.thenAccept(successConsumer)
.exceptionally(error -> {
if (retry) {
self().tell(new RetryOpenConnection(openConnection, error, ignoreErrors, command.getSender()),
ActorRef.noSender());
} else {
handleOpenConnectionError(error, ignoreErrors, command.getSender());
}
handleOpenConnectionError(error, ignoreErrors, command.getSender());
return null;
});
}

private void handleOpenConnectionError(final RetryOpenConnection retryOpenConnection) {
handleOpenConnectionError(retryOpenConnection.error,
retryOpenConnection.ignoreErrors,
retryOpenConnection.sender);
}

private void handleOpenConnectionError(final Throwable error, final boolean ignoreErrors, final ActorRef sender) {
if (ignoreErrors) {
// log the exception and proceed
Expand All @@ -871,9 +854,6 @@ private void handleOpenConnectionError(final Throwable error, final boolean igno
}
}

private record RetryOpenConnection(OpenConnection openConnection, Throwable error, boolean ignoreErrors,
ActorRef sender) {}

private void closeConnection(final StagedCommand command) {
final CloseConnection closeConnection = CloseConnection.of(entityId, command.getDittoHeaders());
broadcastToClientActorsIfStarted(closeConnection)
Expand Down Expand Up @@ -1188,7 +1168,7 @@ private void restoreOpenConnection() {
ConnectionOpened.of(entityId, getRevisionNumber(), Instant.now(), DittoHeaders.empty(), null);
final StagedCommand stagedCommand = StagedCommand.of(connect, connectionOpened, connect,
Collections.singletonList(ConnectionAction.UPDATE_SUBSCRIPTIONS));
openConnection(stagedCommand, false, true);
openConnection(stagedCommand, false);
}

private ConnectivityCommandInterceptor getCommandValidator() {
Expand Down

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions connectivity/service/src/main/resources/connectivity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ditto {
}

extensions {
updated-connection-tester = "org.eclipse.ditto.connectivity.service.messaging.persistence.DefaultUpdatedConnectionTester"
# Factory for custom connection priority provider.
connection-priority-provider-factory = "org.eclipse.ditto.connectivity.service.messaging.persistence.UsageBasedPriorityProviderFactory"
# Factory for custom client actor props.
Expand Down Expand Up @@ -178,13 +177,6 @@ ditto {
all-client-actors-on-one-node = false
all-client-actors-on-one-node = ${?CONNECTIVITY_ALL_CLIENT_ACTORS_ON_ONE_NODE}

# Whether double decoding of usernames and passwords in connection URIs is enabled.
double-decoding-enabled = true
double-decoding-enabled = ${?CONNECTIVITY_DOUBLE_DECODING_ENABLED}

double-decoding-migration.enabled = true
double-decoding-migration.enabled = ${?CONNECTIVITY_DOUBLE_DECODING_MIGRATION_ENABLED}

acknowledgement {
# lifetime of ack forwarder. Must be bigger than the largest possible command timeout (60s)
forwarder-fallback-timeout = 65s
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions connectivity/service/src/test/resources/connection-test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ connection {

all-client-actors-on-one-node = true

double-decoding-enabled = false

ack-label-declare-interval = 99s

mqtt {
Expand Down
1 change: 0 additions & 1 deletion connectivity/service/src/test/resources/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ akka.cluster.roles = ["thing-event-aware", "live-signal-aware", "acks-aware", "p

ditto {
extensions {
updated-connection-tester = org.eclipse.ditto.connectivity.service.messaging.persistence.AlwaysFailingUpdatedConnectionTester
connection-priority-provider-factory = org.eclipse.ditto.connectivity.service.messaging.persistence.UsageBasedPriorityProviderFactory
client-actor-props-factory = org.eclipse.ditto.connectivity.service.messaging.DefaultClientActorPropsFactory
message-mapper-extension = "org.eclipse.ditto.connectivity.service.mapping.NoOpMessageMapperExtension"
Expand Down

0 comments on commit d5bfcc2

Please sign in to comment.