public void logSubscriptionRemoval(final String channel, final int streamId, final long subscriptionId)
    {
        final int length = SIZE_OF_INT * 2 + SIZE_OF_LONG + channel.length();
        final int captureLength = captureLength(length);
        final int encodedLength = encodedLength(captureLength);

        final ManyToOneRingBuffer ringBuffer = this.ringBuffer;
        final int index = ringBuffer.tryClaim(toEventCodeId(REMOVE_SUBSCRIPTION_CLEANUP), encodedLength);
        if (index > 0)
        {
            try
            {
                final UnsafeBuffer buffer = (UnsafeBuffer)ringBuffer.buffer();
                encodeSubscriptionRemoval(buffer, index, captureLength, length, channel, streamId, subscriptionId);
            }
            finally
            {
                ringBuffer.commit(index);
            }
        }
    }
@Test
    void logSubscriptionRemoval()
    {
        final int recordOffset = align(131, ALIGNMENT);
        logBuffer.putLong(CAPACITY + TAIL_POSITION_OFFSET, recordOffset);
        final String uri = "uri";
        final int streamId = 42;
        final long id = 19;
        final int captureLength = uri.length() + SIZE_OF_INT * 2 + SIZE_OF_LONG;

        logger.logSubscriptionRemoval(uri, streamId, id);

        verifyLogHeader(
            logBuffer, recordOffset, toEventCodeId(REMOVE_SUBSCRIPTION_CLEANUP), captureLength, captureLength);
        assertEquals(streamId, logBuffer.getInt(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH), LITTLE_ENDIAN));
        assertEquals(id,
            logBuffer.getLong(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + SIZE_OF_INT), LITTLE_ENDIAN));
        assertEquals(uri,
            logBuffer.getStringAscii(encodedMsgOffset(recordOffset + LOG_HEADER_LENGTH + SIZE_OF_INT + SIZE_OF_LONG),
            LITTLE_ENDIAN));
    }