Skip to content

Commit

Permalink
[Java] Add different aliases for consensus module/service container s…
Browse files Browse the repository at this point in the history
…ubscriptions. (#1366)
  • Loading branch information
JPWatson authored Oct 3, 2022
1 parent e0b8598 commit dd2f57f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aeron-cluster/src/main/java/io/aeron/cluster/Election.java
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ private Subscription addFollowerSubscription()
.rejoin(Boolean.FALSE)
.socketRcvbufLength(logChannelUri)
.receiverWindowLength(logChannelUri)
.alias("log")
.alias("log-cm")
.build();

return aeron.addSubscription(channel, ctx.logStreamId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ final class ClusteredServiceAgent extends ClusteredServiceAgentHotFields impleme
private final Collection<ClientSession> unmodifiableClientSessions = Collections.unmodifiableCollection(sessions);
private final BoundedLogAdapter logAdapter;
private final DutyCycleTracker dutyCycleTracker;
private final String subscriptionAlias;
private String activeLifecycleCallbackName;
private ReadableCounter commitPosition;
private ActiveLogEvent activeLogEvent;
Expand All @@ -127,6 +128,7 @@ final class ClusteredServiceAgent extends ClusteredServiceAgentHotFields impleme
epochClock = ctx.epochClock();
nanoClock = ctx.nanoClock();
dutyCycleTracker = ctx.dutyCycleTracker();
subscriptionAlias = "log-sc-" + ctx.serviceId();

final String channel = ctx.controlChannel();
consensusModuleProxy = new ConsensusModuleProxy(aeron.addPublication(channel, ctx.consensusModuleStreamId()));
Expand Down Expand Up @@ -762,7 +764,11 @@ private void joinActiveLog(final ActiveLogEvent activeLog)
disconnectEgress(ctx.countedErrorHandler());
}

Subscription logSubscription = aeron.addSubscription(activeLog.channel, activeLog.streamId);
final String channel = new ChannelUriStringBuilder(activeLog.channel)
.alias(subscriptionAlias)
.build();

Subscription logSubscription = aeron.addSubscription(channel, activeLog.streamId);
try
{
final Image image = awaitImage(activeLog.sessionId, logSubscription);
Expand Down

0 comments on commit dd2f57f

Please # to comment.