Search in sources :

Example 1 with PublicationParams

use of io.aeron.driver.PublicationParams in project aeron by real-logic.

the class DriverConductor method onAddNetworkPublication.

void onAddNetworkPublication(final String channel, final int streamId, final long correlationId, final long clientId, final boolean isExclusive) {
    final UdpChannel udpChannel = UdpChannel.parse(channel);
    final ChannelUri channelUri = udpChannel.channelUri();
    final PublicationParams params = getPublicationParams(context, channelUri, isExclusive, false);
    validateMtuForMaxMessage(params, isExclusive);
    final SendChannelEndpoint channelEndpoint = getOrCreateSendChannelEndpoint(udpChannel);
    NetworkPublication publication = null;
    if (!isExclusive) {
        publication = findPublication(networkPublications, streamId, channelEndpoint);
    }
    if (null == publication) {
        if (params.hasSessionId) {
            confirmSessionIdNotInUse(params.sessionId);
        }
        publication = newNetworkPublication(correlationId, streamId, channel, udpChannel, channelEndpoint, params, isExclusive);
    } else {
        confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId());
    }
    publicationLinks.add(new PublicationLink(correlationId, getOrAddClient(clientId), publication));
    clientProxy.onPublicationReady(correlationId, publication.registrationId(), streamId, publication.sessionId(), publication.rawLog().fileName(), publication.publisherLimitId(), channelEndpoint.statusIndicatorCounterId(), isExclusive);
}
Also used : ChannelUri(io.aeron.ChannelUri) PublicationParams(io.aeron.driver.PublicationParams) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) UdpChannel(io.aeron.driver.media.UdpChannel)

Example 2 with PublicationParams

use of io.aeron.driver.PublicationParams in project aeron by real-logic.

the class DriverConductor method getOrAddIpcPublication.

private IpcPublication getOrAddIpcPublication(final long correlationId, final int streamId, final String channel, final boolean isExclusive) {
    IpcPublication publication = null;
    final ChannelUri channelUri = ChannelUri.parse(channel);
    final PublicationParams params = getPublicationParams(context, channelUri, isExclusive, true);
    if (!isExclusive) {
        publication = findSharedIpcPublication(ipcPublications, streamId);
    }
    if (null == publication) {
        if (params.hasSessionId) {
            confirmSessionIdNotInUse(params.sessionId);
        }
        validateMtuForMaxMessage(params, isExclusive);
        publication = addIpcPublication(correlationId, streamId, channel, isExclusive, params);
    } else {
        confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId());
    }
    return publication;
}
Also used : ChannelUri(io.aeron.ChannelUri) PublicationParams(io.aeron.driver.PublicationParams)

Example 3 with PublicationParams

use of io.aeron.driver.PublicationParams in project Aeron by real-logic.

the class DriverConductor method onAddIpcPublication.

void onAddIpcPublication(final String channel, final int streamId, final long correlationId, final long clientId, final boolean isExclusive) {
    IpcPublication publication = null;
    final ChannelUri channelUri = ChannelUri.parse(channel);
    final PublicationParams params = getPublicationParams(channelUri, ctx, this, true);
    if (!isExclusive) {
        publication = findSharedIpcPublication(ipcPublications, streamId);
    }
    boolean isNewPublication = false;
    if (null == publication) {
        if (params.hasSessionId) {
            checkForSessionClash(params.sessionId, streamId, IPC_MEDIA, channel);
        }
        validateMtuForMaxMessage(params, channel);
        publication = addIpcPublication(correlationId, clientId, streamId, channel, isExclusive, params);
        isNewPublication = true;
    } else {
        confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId(), publication.channel(), publication.initialTermId(), publication.startingTermId(), publication.startingTermOffset());
    }
    publicationLinks.add(new PublicationLink(correlationId, getOrAddClient(clientId), publication));
    clientProxy.onPublicationReady(correlationId, publication.registrationId(), streamId, publication.sessionId(), publication.rawLog().fileName(), publication.publisherLimitId(), ChannelEndpointStatus.NO_ID_ALLOCATED, isExclusive);
    if (isNewPublication) {
        linkIpcSubscriptions(publication);
    }
}
Also used : ChannelUri(io.aeron.ChannelUri) PublicationParams(io.aeron.driver.PublicationParams)

Example 4 with PublicationParams

use of io.aeron.driver.PublicationParams in project Aeron by real-logic.

the class DriverConductor method onAddNetworkPublication.

void onAddNetworkPublication(final String channel, final int streamId, final long correlationId, final long clientId, final boolean isExclusive) {
    final UdpChannel udpChannel = UdpChannel.parse(channel, nameResolver);
    final ChannelUri channelUri = udpChannel.channelUri();
    final PublicationParams params = getPublicationParams(channelUri, ctx, this, false);
    validateEndpointForPublication(udpChannel);
    validateMtuForMaxMessage(params, channel);
    final SendChannelEndpoint channelEndpoint = getOrCreateSendChannelEndpoint(params, udpChannel, correlationId);
    NetworkPublication publication = null;
    if (!isExclusive) {
        publication = findPublication(networkPublications, streamId, channelEndpoint);
    }
    boolean isNewPublication = false;
    if (null == publication) {
        if (params.hasSessionId) {
            checkForSessionClash(params.sessionId, streamId, udpChannel.canonicalForm(), channel);
        }
        publication = newNetworkPublication(correlationId, clientId, streamId, channel, udpChannel, channelEndpoint, params, isExclusive);
        isNewPublication = true;
    } else {
        confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId(), publication.channel(), publication.initialTermId(), publication.startingTermId(), publication.startingTermOffset());
        validateSpiesSimulateConnection(params, publication.spiesSimulateConnection(), channel, publication.channel());
    }
    publicationLinks.add(new PublicationLink(correlationId, getOrAddClient(clientId), publication));
    clientProxy.onPublicationReady(correlationId, publication.registrationId(), streamId, publication.sessionId(), publication.rawLog().fileName(), publication.publisherLimitId(), channelEndpoint.statusIndicatorCounterId(), isExclusive);
    if (isNewPublication) {
        linkSpies(subscriptionLinks, publication);
    }
}
Also used : ChannelUri(io.aeron.ChannelUri) PublicationParams(io.aeron.driver.PublicationParams) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) UdpChannel(io.aeron.driver.media.UdpChannel)

Aggregations

ChannelUri (io.aeron.ChannelUri)4 PublicationParams (io.aeron.driver.PublicationParams)4 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)2 UdpChannel (io.aeron.driver.media.UdpChannel)2