Main lane

This commit is contained in:
Andrea Cavalli 2022-09-22 16:05:56 +02:00
parent 83c064220f
commit b322400d87
4 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package it.tdlight.reactiveapi;
import static it.tdlight.reactiveapi.Lanes.MAIN_LANE;
import static java.util.Collections.unmodifiableSet;
import it.tdlight.reactiveapi.CreateSessionRequest.CreateBotSessionRequest;
@ -114,7 +115,7 @@ public class Cli {
if (parts.length == 4) {
lane = parts[3];
} else {
lane = "";
lane = MAIN_LANE;
}
CreateSessionRequest request = switch (parts[0]) {
case "bot" -> new CreateBotSessionRequest(Long.parseLong(parts[1]), parts[2], lane);

View File

@ -1,5 +1,7 @@
package it.tdlight.reactiveapi;
import static it.tdlight.reactiveapi.Lanes.MAIN_LANE;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@ -23,7 +25,7 @@ public class DiskSession {
@JsonProperty("lane") @Nullable String lane) {
this.token = token;
this.phoneNumber = phoneNumber;
this.lane = Objects.requireNonNullElse(lane, "");
this.lane = Objects.requireNonNullElse(lane, MAIN_LANE);
this.validate();
}

View File

@ -16,7 +16,7 @@ public record KafkaParameters(String groupId, String clientId, String bootstrapS
public Set<String> getAllLanes() {
var lanes = new LinkedHashSet<String>(this.lanes.size() + 1);
lanes.add("");
lanes.add("main");
lanes.addAll(this.lanes);
return lanes;
}

View File

@ -0,0 +1,5 @@
package it.tdlight.reactiveapi;
public class Lanes {
public static final String MAIN_LANE = "main";
}