Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mesh worker service not set the default value for ForwardSourceMessageProperty #300

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/spec/utils.go
Expand Up @@ -245,7 +245,7 @@ func generateSourceOutputSpec(source *v1alpha1.Source) *proto.SinkSpec {
BatchBuilder: source.Spec.Output.ProducerConf.BatchBuilder,
}
}
var forward = false
var forward = true
if source.Spec.ForwardSourceMessageProperty != nil {
forward = *source.Spec.ForwardSourceMessageProperty
}
Expand Down
Expand Up @@ -207,7 +207,9 @@ public static V1alpha1Function createV1alpha1FunctionFromFunctionConfig(String k
v1alpha1FunctionSpec.setLogTopic(functionDetails.getLogTopic());
}
v1alpha1FunctionSpec.setForwardSourceMessageProperty(functionDetails.getSink().getForwardSourceMessageProperty());

if (v1alpha1FunctionSpec.getForwardSourceMessageProperty() == null) {
v1alpha1FunctionSpec.setForwardSourceMessageProperty(true);
}
if (functionDetails.hasRetryDetails()) {
v1alpha1FunctionSpec.setMaxMessageRetry(functionDetails.getRetryDetails().getMaxMessageRetries());
if (!StringUtils.isEmpty(functionDetails.getRetryDetails().getDeadLetterTopic())) {
Expand Down
Expand Up @@ -147,6 +147,9 @@ public static V1alpha1Source createV1alpha1SourceFromSourceConfig(String kind, S
v1alpha1SourceSpecOutput.setSinkSchemaType(functionDetails.getSink().getSchemaType());
}
v1alpha1SourceSpec.setForwardSourceMessageProperty(functionDetails.getSink().getForwardSourceMessageProperty());
if (v1alpha1SourceSpec.getForwardSourceMessageProperty() == null) {
v1alpha1SourceSpec.setForwardSourceMessageProperty(true);
}
// process ProducerConf
V1alpha1SourceSpecOutputProducerConf v1alpha1SourceSpecOutputProducerConf
= new V1alpha1SourceSpecOutputProducerConf();
Expand Down
Expand Up @@ -81,6 +81,7 @@ public static FunctionConfig CreateJavaFunctionWithPackageURLConfig(String tenan
functionConfig.setCustomRuntimeOptions(customRuntimeOptionsJSON);
functionConfig.setJar(String.format("function://public/default/%s@1.0", functionName));
functionConfig.setAutoAck(true);
functionConfig.setForwardSourceMessageProperty(true);
return functionConfig;
}

Expand Down
Expand Up @@ -106,7 +106,7 @@ public void testCreateV1alpha1FunctionFromFunctionConfig() {
Assert.assertEquals(v1alpha1FunctionSpec.getInput().getTypeClassName(), typeClassName);
Assert.assertEquals(v1alpha1FunctionSpec.getOutput().getTypeClassName(), typeClassName);
Assert.assertEquals(v1alpha1FunctionSpec.getJava().getJar(), jar);

Assert.assertEquals(v1alpha1FunctionSpec.getForwardSourceMessageProperty(), true);
}

@Test
Expand Down
Expand Up @@ -197,5 +197,6 @@ public void testCreateV1alpha1SourceFromSinkConfigWithBuiltin() throws IOExcepti
Assert.assertEquals(v1alpha1SourceSpec.getOutput().getTypeClassName(), typeClassName);
Assert.assertEquals(v1alpha1SourceSpec.getJava().getJar(), archive);
Assert.assertEquals(v1alpha1SourceSpec.getSourceConfig(), configs);
Assert.assertEquals(v1alpha1SourceSpec.getForwardSourceMessageProperty(), true);
}
}