Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
@Retention(RUNTIME)
public @interface Output {

String[] value() default { "__default__" };
String value() default "__default__";
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private Optional<Method> getAfterGroup() {
private Stream<String> getOutputParameters(final Method listener) {
return of(listener.getParameters())
.filter(p -> p.isAnnotationPresent(Output.class))
.flatMap(p -> of(p.getAnnotation(Output.class).value()));
.map(p -> p.getAnnotation(Output.class).value());
}

private Stream<String> getReturnedBranches(final Method listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,9 @@
*/
package org.talend.sdk.component.runtime.output;

import org.talend.sdk.component.api.processor.MultiOutputIterator;
import org.talend.sdk.component.api.processor.OutputEmitter;

public interface OutputFactory {

OutputEmitter create(String name);

/**
* Creates a {@link MultiOutputIterator} that routes records lazily to one or more
* output connections without buffering.
*
* <p>
* Supported only in the Studio DI runtime.
*
* @param <T> the record type
* @return a MultiOutputIterator for lazy streaming
* @throws UnsupportedOperationException if the runtime does not support multi-output iterator mode
*/
default <T> MultiOutputIterator<T> createMultiOutputIterator() {
throw new UnsupportedOperationException(
"MultiOutputIterator is only supported in the Studio DI runtime");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.talend.sdk.component.api.processor.ElementListener;
import org.talend.sdk.component.api.processor.Input;
import org.talend.sdk.component.api.processor.LastGroup;
import org.talend.sdk.component.api.processor.MultiOutputIterator;
import org.talend.sdk.component.api.processor.Output;
import org.talend.sdk.component.api.service.record.RecordBuilderFactory;
import org.talend.sdk.component.runtime.base.Delegated;
Expand Down Expand Up @@ -151,11 +150,10 @@ public void beforeGroup() {

private BiFunction<InputFactory, OutputFactory, Object> buildProcessParamBuilder(final Parameter parameter) {
if (parameter.isAnnotationPresent(Output.class)) {
if (MultiOutputIterator.class == parameter.getType()) {
return (inputs, outputs) -> outputs.createMultiOutputIterator();
}
final String name = parameter.getAnnotation(Output.class).value()[0];
return (inputs, outputs) -> outputs.create(name);
return (inputs, outputs) -> {
final String name = parameter.getAnnotation(Output.class).value();
return outputs.create(name);
};
}

final Class<?> parameterType = parameter.getType();
Expand All @@ -169,10 +167,7 @@ private Function<OutputFactory, Object> toOutputParamBuilder(final Parameter par
if (parameter.isAnnotationPresent(LastGroup.class)) {
return false;
}
if (MultiOutputIterator.class == parameter.getType()) {
return outputs.createMultiOutputIterator();
}
final String name = parameter.getAnnotation(Output.class).value()[0];
final String name = parameter.getAnnotation(Output.class).value();
return outputs.create(name);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.talend.sdk.component.api.processor.BeforeGroup;
import org.talend.sdk.component.api.processor.ElementListener;
import org.talend.sdk.component.api.processor.LastGroup;
import org.talend.sdk.component.api.processor.MultiOutputIterator;
import org.talend.sdk.component.api.processor.Output;
import org.talend.sdk.component.api.processor.OutputEmitter;
import org.talend.sdk.component.api.processor.Processor;
Expand Down Expand Up @@ -196,8 +195,7 @@ private void validateProcessor(final Class<?> input) {
afterGroups.forEach(m -> {
final List<Parameter> invalidParams = Stream.of(m.getParameters()).peek(p -> {
if (p.isAnnotationPresent(Output.class) && !validOutputParam(p)) {
throw new IllegalArgumentException(
"@Output parameter must be of type OutputEmitter or MultiOutputIterator");
throw new IllegalArgumentException("@Output parameter must be of type OutputEmitter");
}
})
.filter(p -> !p.isAnnotationPresent(Output.class))
Expand Down Expand Up @@ -245,8 +243,7 @@ private void validateProducer(final Class<?> input, final List<Method> afterGrou

if (!producers.isEmpty() && Stream.of(producers.get(0).getParameters()).peek(p -> {
if (p.isAnnotationPresent(Output.class) && !validOutputParam(p)) {
throw new IllegalArgumentException(
"@Output parameter must be of type OutputEmitter or MultiOutputIterator");
throw new IllegalArgumentException("@Output parameter must be of type OutputEmitter");
}
}).filter(p -> !p.isAnnotationPresent(Output.class)).count() < 1) {
throw new IllegalArgumentException(input + " doesn't have the input parameter on its producer method");
Expand All @@ -257,8 +254,7 @@ private boolean validOutputParam(final Parameter p) {
if (!(p.getParameterizedType() instanceof ParameterizedType pt)) {
return false;
}
return OutputEmitter.class == pt.getRawType()
|| MultiOutputIterator.class == pt.getRawType();
return OutputEmitter.class == pt.getRawType();
}

private Stream<Class<? extends Annotation>> getPartitionMapperMethods(final boolean infinite) {
Expand Down
Loading
Loading