Question

I just started using the Optaplanner as a way to do vehicle routing. However I would like to expose the optaplanner as a web service (preferably REST).

Now I've read on several blogs that it can be done with Apache Camel. However finding a decent example seems impossible.

Are there any known examples that I can look at or any tips on how to expose this?

Était-ce utile?

La solution

There are several ways to expose it as a REST service:

  • RESTEasy: Annotate your domain objects with JAXB annotations (to define the structure of the XML file send over HTTP). Then write a Java class with JAX-RS annotations (to define the available REST methods). RESTEasy has a good reference manual, it focusses on REST and it allows you to tailer to the REST interface exactly as your client would like it. Deploy to a servlet container (WildFly, Jetty, ...).
  • Camel: See camel-optaplanner documentation and then camel's documentation (or book) about REST specifically and deploying camel. Note that the camel-optaplanner module is relative young, but it's unit tested and works.
  • Other REST technologies in the Java ecosystem

Anyway, OptaPlanner doesn't care how you expose it as a REST service (so it doesn't hinder you either):

integration

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top