@SuppressWarnings("unchecked")
    public @NonNull Result complete()
            throws IllegalStateException, PipelineException {
        final LinkedList<? extends ServiceRepository<@NonNull Context, @NonNull Result>
                .ServiceWrapper<? extends Service<@NonNull Context, @NonNull Result>>>
                queue = this.repository.queue();
        queue.sort(null); // Sort using the built in comparator method
        ServiceRepository<Context, Result>.ServiceWrapper<? extends Service<Context, Result>>
                wrapper;
        boolean consumerService = false;
        while ((wrapper = queue.pollLast()) != null) {
            consumerService = wrapper.implementation() instanceof ConsumerService;
            if (!ServiceFilterHandler.INSTANCE.passes(wrapper, this.context)) {
                continue;
            }
            final Result result;
            try {
                result = wrapper.implementation().handle(this.context);
            } catch (final Exception e) {
                throw new PipelineException(String.format("Failed to retrieve result from %s", wrapper), e);
            }
            if (wrapper.implementation() instanceof SideEffectService) {
                if (result == null) {
                    throw new IllegalStateException(String.format("SideEffectService '%s' returned null", wrapper));
                } else if (result == State.ACCEPTED) {
                    return result;
                }
            } else if (result != null) {
                return result;
            }
        }
        // This is hack to make it so that the default
        // consumer implementation does not have to call #interrupt
        if (consumerService) {
            return (Result) State.ACCEPTED;
        }
        throw new IllegalStateException(
                "No service consumed the context. This means that the pipeline was not constructed properly.");
    }
Returns the first result that is generated for the given context. This cannot return {@code null}.

<p>If nothing manages to produce a result, an exception will be thrown. If the pipeline has been
constructed properly, this will never happen.</p>

@return generated result
@throws IllegalStateException If no result was found. This only happens if the pipeline has not
                              been constructed properly. The most likely cause is a faulty
                              default implementation
@throws IllegalStateException If a {@link SideEffectService} returns {@code null}
@throws PipelineException     Any exceptions thrown during result retrieval from the
                              implementations will be wrapped by {@link PipelineException}. Use
                              {@link PipelineException#getCause()} to get the exception that
                              was thrown.
@throws PipelineException     Any exceptions thrown during filtering will be wrapped by {@link
                              PipelineException}. Use {@link PipelineException#getCause()} to
                              get the exception that was thrown.
@see PipelineException PipelineException wraps exceptions thrown during filtering and result
        retrieval
cloud-services/src/main/java/org/incendo/cloud/services/ServiceSpigot.java