Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support k3po ephemeral option
  • Loading branch information
akrambek committed Feb 15, 2024
commit 2e4de49f3e42f979ca4a7317e317fa6381142f66
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,44 @@ public final class ZillaChannelAddress extends ChannelAddress
private final long authorization;
private final String namespace;
private final String binding;
private final String ephemeralName;

public ZillaChannelAddress(
URI location,
long authorization,
String namespace)
String namespace,
String ephemeral)
{
this(location, authorization, namespace, bindingName(location));
this(location, authorization, namespace, bindingName(location), ephemeral);
}

private ZillaChannelAddress(
URI location,
long authorization,
String namespace,
String binding)
String binding,
String ephemeral)
{
super(location);

this.authorization = authorization;
this.namespace = requireNonNull(namespace);
this.binding = requireNonNull(binding);
this.ephemeralName = requireNonNull(ephemeral);
}

private ZillaChannelAddress(
URI location,
ChannelAddress transport,
boolean ephemeral,
String ephemeralName,
long authorization,
String namespace,
String binding)
{
super(location, transport, ephemeral);

this.ephemeralName = ephemeralName;
this.authorization = authorization;
this.namespace = requireNonNull(namespace);
this.binding = requireNonNull(binding);
Expand Down Expand Up @@ -97,7 +103,7 @@ private ZillaChannelAddress newEphemeralAddress(
URI location,
ChannelAddress transport)
{
return new ZillaChannelAddress(location, transport, true, authorization, "ephemeral", binding);
return new ZillaChannelAddress(location, transport, true, ephemeralName, authorization, ephemeralName, binding);
}

private static String bindingName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_AUTHORIZATION;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_BUDGET_ID;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_BYTE_ORDER;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_EPHEMERAL;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_PADDING;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_REPLY_TO;
import static io.aklivity.zilla.runtime.engine.test.internal.k3po.ext.types.ZillaTypeSystem.OPTION_STREAM_ID;
Expand Down Expand Up @@ -72,7 +73,7 @@ protected ChannelAddress newChannelAddress0(
}
}

Collection<TypeInfo<?>> allOptionTypes = asList(OPTION_REPLY_TO, OPTION_WINDOW, OPTION_BUDGET_ID,
Collection<TypeInfo<?>> allOptionTypes = asList(OPTION_EPHEMERAL, OPTION_REPLY_TO, OPTION_WINDOW, OPTION_BUDGET_ID,
OPTION_STREAM_ID, OPTION_PADDING, OPTION_UPDATE, OPTION_AUTHORIZATION, OPTION_THROTTLE,
OPTION_TRANSMISSION, OPTION_BYTE_ORDER);
for (TypeInfo<?> optionType : allOptionTypes)
Expand All @@ -90,7 +91,8 @@ protected ChannelAddress newChannelAddress0(

final long authorization = (Long) options.getOrDefault(OPTION_AUTHORIZATION.getName(), 0L);
final String replyTo = (String) options.getOrDefault(OPTION_REPLY_TO.getName(), "test");
final String ephemeral = (String) options.getOrDefault(OPTION_EPHEMERAL.getName(), "ephemeral");

return new ZillaChannelAddress(location, authorization, replyTo);
return new ZillaChannelAddress(location, authorization, replyTo, ephemeral);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class ZillaTypeSystem implements TypeSystemSpi
{
public static final String NAME = "zilla";

public static final TypeInfo<String> OPTION_EPHEMERAL = new TypeInfo<>("ephemeral", String.class);
public static final TypeInfo<String> OPTION_REPLY_TO = new TypeInfo<>("replyTo", String.class);
public static final TypeInfo<Integer> OPTION_WINDOW = new TypeInfo<>("window", Integer.class);
public static final TypeInfo<Integer> OPTION_SHARED_WINDOW = new TypeInfo<>("sharedWindow", Integer.class);
Expand Down Expand Up @@ -95,6 +96,7 @@ public ZillaTypeSystem()
this.acceptOptions = unmodifiableSet(acceptOptions);

Set<TypeInfo<?>> connectOptions = new LinkedHashSet<>();
connectOptions.add(OPTION_EPHEMERAL);
connectOptions.add(OPTION_REPLY_TO);
connectOptions.add(OPTION_WINDOW);
connectOptions.add(OPTION_SHARED_WINDOW);
Expand Down