Skip to content

Commit

Permalink
Fix: auto-ack flag always set true (#2496)
Browse files Browse the repository at this point in the history
make ato-ack default true
  • Loading branch information
rdhabalia committed Aug 31, 2018
1 parent e71540e commit 5fb58d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Expand Up @@ -200,6 +200,7 @@ public void testCreateFunction() throws Exception {
"--inputs", inputTopicName,
"--output", outputTopicName,
"--jar", "SomeJar.jar",
"--auto-ack", "false",
"--tenant", "sample",
"--namespace", "ns1",
"--className", DummyFunction.class.getName(),
Expand All @@ -209,6 +210,7 @@ public void testCreateFunction() throws Exception {
assertEquals(fnName, creater.getFunctionName());
assertEquals(inputTopicName, creater.getInputs());
assertEquals(outputTopicName, creater.getOutput());
assertEquals(false, creater.isAutoAck());

verify(functions, times(1)).createFunction(any(FunctionDetails.class), anyString());

Expand Down
Expand Up @@ -313,8 +313,8 @@ abstract class FunctionDetailsCommand extends BaseCommand {
// for backwards compatibility purposes
@Parameter(names = "--autoAck", description = "Whether or not the framework will automatically acknowleges messages", hidden = true)
protected Boolean DEPRECATED_autoAck = null;
@Parameter(names = "--auto-ack", description = "Whether or not the framework will automatically acknowleges messages")
protected Boolean autoAck ;
@Parameter(names = "--auto-ack", description = "Whether or not the framework will automatically acknowleges messages", arity = 1)
protected boolean autoAck = true;
// for backwards compatibility purposes
@Parameter(names = "--timeoutMs", description = "The message timeout in milliseconds", hidden = true)
protected Long DEPRECATED_timeoutMs;
Expand Down Expand Up @@ -458,11 +458,7 @@ void processArguments() throws Exception {

functionConfig.setWindowConfig(windowConfig);

if (null != autoAck) {
functionConfig.setAutoAck(autoAck);
} else {
functionConfig.setAutoAck(true);
}
functionConfig.setAutoAck(autoAck);

if (null != jarFile) {
functionConfig.setJar(jarFile);
Expand Down Expand Up @@ -577,7 +573,7 @@ private void inferMissingArguments(FunctionConfig functionConfig) {
WindowUtils.inferDefaultConfigs(windowConfig);
// set auto ack to false since windowing framework is responsible
// for acking and not the function framework
if (autoAck != null && autoAck == true) {
if (autoAck) {
throw new ParameterException("Cannot enable auto ack when using windowing functionality");
}
functionConfig.setAutoAck(false);
Expand Down

0 comments on commit 5fb58d2

Please sign in to comment.