0
votes

I have a file transfer routing developed in Apache camel. I want to embed Jetty server into this project so that i can keep the service running without deploying it to another server. It will be really helpful if someone can put some code.

Thank You.

2
Check this resource blog.kopis.de/2015/06/14/microservices-with-apache-camel maybe it will answer your needs. However - maybe you should be clear what do you mean by "project".gusto2
Are you asking how to run this as a stand-alone program driven from it's main()? i.e., as described on this Camel page: camel.apache.org/…Darius X.

2 Answers

0
votes

You should use Camel's Jetty component and declare a consumer, which will automatically bring up an embedded Jetty:

from("jetty:http://localhost:{{port}}/myapp/myservice")
    .process(new MyProcessor());
-1
votes

You have 2 options, they are quite popular:

  1. Use maven camel:run plugin, you have to just enable this in your pom file and run the command. (I am not too sure whether they use Jetty internally, but it works)

  2. Spring boot, Its quite easy to create a project nowadays, using the web portal.

  3. There is one more maven plugin as well for Jetty , which is mvn jetty:run