Main lane
This commit is contained in:
parent
83c064220f
commit
b322400d87
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
5
src/main/java/it/tdlight/reactiveapi/Lanes.java
Normal file
5
src/main/java/it/tdlight/reactiveapi/Lanes.java
Normal file
@ -0,0 +1,5 @@
|
||||
package it.tdlight.reactiveapi;
|
||||
|
||||
public class Lanes {
|
||||
public static final String MAIN_LANE = "main";
|
||||
}
|
Loading…
Reference in New Issue
Block a user