Skip to content

Commit

Permalink
added "akka-discovery-kubernetes-api" and "akka-lease-kubernetes" dep…
Browse files Browse the repository at this point in the history
…endencies to ditto-base-service so that all services depend on it

* made EmptyEvent not require the added "eventType" JSON field in order to not break old events

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed May 5, 2021
1 parent f2c5e5f commit 0e09fcf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
9 changes: 9 additions & 0 deletions base/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@
<artifactId>akka-management-cluster-http_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>com.lightbend.akka.discovery</groupId>
<artifactId>akka-discovery-kubernetes-api_${scala.version}</artifactId>
</dependency>
<dependency>
<groupId>com.lightbend.akka.management</groupId>
<artifactId>akka-lease-kubernetes_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>com.github.scullxbones</groupId>
<artifactId>akka-persistence-mongo-common_${scala.version}</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions concierge/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
<artifactId>akka-http_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>com.lightbend.akka.discovery</groupId>
<artifactId>akka-discovery-kubernetes-api_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

import org.eclipse.ditto.json.JsonFactory;
import org.eclipse.ditto.json.JsonField;
import org.eclipse.ditto.json.JsonFieldDefinition;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.json.JsonObjectBuilder;
import org.eclipse.ditto.json.JsonPointer;
import org.eclipse.ditto.json.JsonValue;
import org.eclipse.ditto.base.model.entity.id.EntityId;
import org.eclipse.ditto.base.model.entity.id.WithEntityId;
import org.eclipse.ditto.base.model.entity.metadata.Metadata;
Expand All @@ -36,6 +29,13 @@
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
import org.eclipse.ditto.base.model.signals.events.Event;
import org.eclipse.ditto.base.model.signals.events.EventJsonDeserializer;
import org.eclipse.ditto.json.JsonFactory;
import org.eclipse.ditto.json.JsonField;
import org.eclipse.ditto.json.JsonFieldDefinition;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.json.JsonObjectBuilder;
import org.eclipse.ditto.json.JsonPointer;
import org.eclipse.ditto.json.JsonValue;

/**
* An "empty" event which can be persisted to the backing event journal which does not contain any change "instruction"
Expand All @@ -61,6 +61,13 @@ public final class EmptyEvent implements Event<EmptyEvent>, WithEntityId {

static final String TYPE = TYPE_PREFIX + NAME;

/**
* For already persisted events the {@link #JSON_ENTITY_TYPE} might not be present. In this case, fall back to this
* type.
* Should not have a relevance for EmptyEvent anyhow.
*/
private static final EntityType UNKNOWN_ENTITY_TYPE = EntityType.of("unknown");

private static final JsonFieldDefinition<String> JSON_ENTITY_TYPE =
JsonFactory.newStringFieldDefinition("entityType", FieldType.REGULAR, JsonSchemaVersion.V_2);

Expand Down Expand Up @@ -97,7 +104,9 @@ public EmptyEvent(final EntityId entityId, final JsonValue effect, final long re
public static EmptyEvent fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) {
return new EventJsonDeserializer<EmptyEvent>(TYPE, jsonObject)
.deserialize((revision, timestamp, metadata) -> {
final EntityType entityType = EntityType.of(jsonObject.getValueOrThrow(JSON_ENTITY_TYPE));
final EntityType entityType = jsonObject.getValue(JSON_ENTITY_TYPE)
.map(EntityType::of)
.orElse(UNKNOWN_ENTITY_TYPE);
final EntityId readEntityId =
EntityId.of(entityType, jsonObject.getValueOrThrow(JSON_ENTITY_ID));
final JsonValue readEffect = jsonObject.getValueOrThrow(JSON_EFFECT);
Expand Down
5 changes: 0 additions & 5 deletions policies/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
<artifactId>akka-http_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>com.lightbend.akka.discovery</groupId>
<artifactId>akka-discovery-kubernetes-api_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions things/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@
<artifactId>akka-http_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>com.lightbend.akka.discovery</groupId>
<artifactId>akka-discovery-kubernetes-api_${scala.version}</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down

0 comments on commit 0e09fcf

Please sign in to comment.