Java Code Examples for io.aeron.Subscription#imageBySessionId()

The following examples show how to use io.aeron.Subscription#imageBySessionId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixEngine.java    From artio with Apache License 2.0 6 votes vote down vote up
private Image replayImage(final String name, final int replaySessionId)
{
    final Subscription subscription = aeron.addSubscription(
        IPC_CHANNEL, configuration.outboundReplayStream());
    StreamInformation.print(name, subscription, configuration);

    // Await replay publication
    while (true)
    {
        final Image image = subscription.imageBySessionId(replaySessionId);
        if (image != null)
        {
            return image;
        }

        invokeAeronConductor();

        Thread.yield();
    }
}
 
Example 2
Source File: FixArchiveScanner.java    From artio with Apache License 2.0 5 votes vote down vote up
private Image lookupImage(final Subscription replaySubscription, final int sessionId)
{
    Image image = null;

    while (image == null)
    {
        idleStrategy.idle();
        image = replaySubscription.imageBySessionId(sessionId);
    }
    idleStrategy.reset();

    return image;
}