kameshsampath opened a new issue #498: Knative pods not scaling down to zero
URL: https://github.com/apache/camel-k/issues/498
 
 
   I am deploying the route like:
   
   // content based router Route 1
   
   ```
   from("aws-s3://data?deleteAfterRead=false")
                                .streamCaching()
                                
.filter(header("CamelAwsS3Key").endsWith(".xml"))
                                .idempotentConsumer(header("CamelAwsS3ETag"), 
idmRepo())
                                .log(LoggingLevel.DEBUG,"Processing File : 
${header.CamelAwsS3Key}")
                                .choice()
                                .when(xpath("/person/country = 'US'"))
                                    .log("Sending Body ${body}")
                                          .to("knative:channel/messages-us")
                                .otherwise()
                                    .log("Sending Body ${body}")
                                                
.to("knative:channel/messages-others")
                                .end();
   ```
   
   // us messages handler 
   
   ```
    from("knative:channel/messages-us")
                           .log(LoggingLevel.DEBUG,
                                           "Received content ${body}")
                                 .setProperty("userName", 
xpath("/person/@user", String.class))
                                 .convertBodyTo(byte[].class)
                                 .log(LoggingLevel.DEBUG,"Writing file 
{{messagesDir}}/${property.userName}.xml")
                                 
.to("file://{{messagesDir}}/us?fileName=${property.userName}.xml")
                                 .end();
   
            from("file:{{messagesDir}}?noop=true&recursive=true")
                                        .log(LoggingLevel.DEBUG,"Processing 
file ${in.header.CamelFileName}")
                                 .setHeader(S3Constants.CONTENT_LENGTH, 
simple("${in.header.CamelFileLength}"))
                   .setHeader(S3Constants.KEY, 
simple("${in.header.CamelFileNameOnly}"))
                   .convertBodyTo(byte[].class)
                   .process(exchange -> {
                       //Build a valid destination bucket name
                       String camelFileRelativePath = 
exchange.getIn().getHeader("CamelFileRelativePath", String.class);
                       String onlyPath = "us-out";
                       if (camelFileRelativePath != null) {
                           log.debug("Camel File Relative Path " + 
camelFileRelativePath);
                           onlyPath = FileUtil.onlyPath(camelFileRelativePath);
                           log.debug("Camel File  onlyPath " + onlyPath);
                       }
                       exchange.setProperty("toBucketName", "messages-"+ 
onlyPath.toLowerCase());
                   })
                                                                .log("Uploading 
file ${header.CamelFileName} to bucket: ${property.toBucketName}")
                   
.toD("aws-s3://${property.toBucketName}?deleteAfterWrite=false")
           .end();
   ```
   
   //other messages handler 
   
   ```
   // @formatter:off
           from("knative:channel/messages-others")
                           .log(LoggingLevel.DEBUG,"Received content ${body}")
                                 .setProperty("userName", 
xpath("/person/@user", String.class))
                                 .convertBodyTo(byte[].class)
                                 .log(LoggingLevel.DEBUG,"Writing file 
{{messagesDir}}/${property.userName}.xml")
                                 
.to("file://{{messagesDir}}/others?fileName=${property.userName}.xml")
                                 .end();
   
            from("file:{{messagesDir}}?noop=true&recursive=true")
                                        .log(LoggingLevel.DEBUG,"Processing 
file ${in.header.CamelFileName}")
                                 .setHeader(S3Constants.CONTENT_LENGTH, 
simple("${in.header.CamelFileLength}"))
                   .setHeader(S3Constants.KEY, 
simple("${in.header.CamelFileNameOnly}"))
                   .convertBodyTo(byte[].class)
                   .process(exchange -> {
                       //Build a valid destination bucket name
                       String camelFileRelativePath = 
exchange.getIn().getHeader("CamelFileRelativePath", String.class);
                       String onlyPath = "others-out";
                       if (camelFileRelativePath != null) {
                           log.debug("Camel File Relative Path " + 
camelFileRelativePath);
                           onlyPath = FileUtil.onlyPath(camelFileRelativePath);
                           log.debug("Camel File  onlyPath " + onlyPath);
                       }
                       exchange.setProperty("toBucketName", "messages-"+ 
onlyPath.toLowerCase());
                   })
                                                                .log("Uploading 
file ${header.CamelFileName} to bucket: ${property.toBucketName}")
                   
.toD("aws-s3://${property.toBucketName}?deleteAfterWrite=false")
           .end();
                  // @formatter:on
   ```
   
   The Knative Camel-k setup works fine and was able to do what the route 
needed to. but once there are no more messages that is available I dont see the 
`usmessages` and `others-messages` handler knative pods scaling down to `0`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to