Skip to content

Commit

Permalink
Issue #106: Let 'ConnectionPersistenceActor' handle 'AddConnectionLog…
Browse files Browse the repository at this point in the history
…Entry'.

Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
  • Loading branch information
Juergen Fickel committed Nov 11, 2021
1 parent 0fb1522 commit d842488
Show file tree
Hide file tree
Showing 4 changed files with 982 additions and 935 deletions.
7 changes: 7 additions & 0 deletions connectivity/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ jmh-generator-annprocess). jmh-generator-annprocess overwrites the whole META-IN
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-internal-utils-akka</artifactId>
<scope>test</scope>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-internal-utils-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.eclipse.ditto.base.model.signals.commands.Command;
import org.eclipse.ditto.base.model.signals.events.Event;
import org.eclipse.ditto.connectivity.api.BaseClientState;
import org.eclipse.ditto.connectivity.api.messaging.monitoring.logs.AddConnectionLogEntry;
import org.eclipse.ditto.connectivity.model.Connection;
import org.eclipse.ditto.connectivity.model.ConnectionId;
import org.eclipse.ditto.connectivity.model.ConnectionLifecycle;
Expand Down Expand Up @@ -632,11 +633,18 @@ protected Receive matchAnyAfterInitialization() {
// maintain client actor refs
.match(ActorRef.class, this::addClientActor)
.match(Terminated.class, this::removeClientActor)
.match(AddConnectionLogEntry.class, this::handleAddConnectionLogEntry)
.build()
.orElse(createInitializationAndConfigUpdateBehavior())
.orElse(super.matchAnyAfterInitialization());
}

private void handleAddConnectionLogEntry(final AddConnectionLogEntry addConnectionLogEntry) {
final var logEntry = addConnectionLogEntry.getLogEntry();
log.withCorrelationId(logEntry.getCorrelationId()).debug("Handling <{}>.", addConnectionLogEntry);
connectionLogger.logEntry(logEntry);
}

@Override
protected Receive matchAnyWhenDeleted() {
return createInitializationAndConfigUpdateBehavior()
Expand Down

0 comments on commit d842488

Please sign in to comment.