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

Json marshalling is needed for Rest route and uncommented code seems to be executed #2341

Closed
bzdgn opened this issue May 27, 2021 · 4 comments

Comments

@bzdgn
Copy link

bzdgn commented May 27, 2021

I've applied the camel rest dsl example here for the Camel K, the simple integration file is as follows, which fails;

import org.apache.camel.builder.RouteBuilder;

public class RestRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        
        // rest endpoints
        rest("/status")
            .get("/hello").to("direct:hello");
        
        // routes
        from("direct:hello")
            .transform().constant("Hello World");
        
    }

}

However, if I add marshal().json() line to the route, it works;

import org.apache.camel.builder.RouteBuilder;

public class RestRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        
        // rest endpoints
        rest("/status")
            .get("/hello").to("direct:hello");
        
        // routes
        from("direct:hello")
            .transform().constant("Hello World")
            .marshal().json();
        
    }

}

And even if I comment out the marshal().json() line, it continues to work;

import org.apache.camel.builder.RouteBuilder;

public class RestRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        
        // rest endpoints
        rest("/status")
            .get("/hello").to("direct:hello");
        
        // routes
        from("direct:hello")
            .transform().constant("Hello World")
            //.marshal().json();
        
    }

}

Is there a problem with this example, or the code I've shared, or is this a bug?

I've also asked this on stackoverflow but I suspect that it may be a bug;

https://stackoverflow.com/questions/67731034/camel-k-rest-route-needs-json-marshalling-and-commented-code-executed

@bzdgn
Copy link
Author

bzdgn commented May 28, 2021

I'm attaching the terminal output and the operator logs here.

Terminal output that includes the output of the kamel --dev mode;

Terminal Output

Camel K Operator logs taken from the MiniKube;

Camel K Operator logs

@lburgazzoli
Copy link
Contributor

I tried to run the same example but it is working for me.
I suspect there is an issue with pulling the base image for the kit, can you try to delete all the kits ?

kubectl delete integrationkits --all

@lburgazzoli
Copy link
Contributor

@bzdgn any update on this ?

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale due to 90 days of inactivity.
It will be closed if no further activity occurs within 15 days.
If you think that’s incorrect or the issue should never stale, please simply write any comment.
Thanks for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants