简体   繁体   English

如何使Optaplanner成为REST Web服务

[英]How to make optaplanner a REST webservice

I just started using the Optaplanner as a way to do vehicle routing. 我刚开始使用Optaplanner作为车辆路线的一种方法。 However I would like to expose the optaplanner as a web service (preferably REST). 但是,我想将optaplanner公开为Web服务(最好是REST)。

Now I've read on several blogs that it can be done with Apache Camel. 现在,我已经在几个博客上阅读到可以使用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? 是否有我可以查看的已知示例或有关如何公开此信息的提示?

There are several ways to expose it as a REST service: 有几种方法可以将其公开为REST服务:

  • RESTEasy : Annotate your domain objects with JAXB annotations (to define the structure of the XML file send over HTTP). RESTEasy :使用JAXB注释注释您的域对象(以定义通过HTTP发送的XML文件的结构)。 Then write a Java class with JAX-RS annotations (to define the available REST methods). 然后编写带有JAX-RS批注的Java类(以定义可用的REST方法)。 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. RESTEasy有一个很好的参考手册,它专注于REST,它使您可以完全按照客户端的意愿尾随REST接口。 Deploy to a servlet container (WildFly, Jetty, ...). 部署到Servlet容器(WildFly,Jetty等)。
  • Camel: See camel-optaplanner documentation and then camel's documentation (or book) about REST specifically and deploying camel. 骆驼:请参阅camel-optaplanner文档 ,然后参阅camel的有关REST和部署骆驼的文档(或书籍)。 Note that the camel-optaplanner module is relative young, but it's unit tested and works. 请注意,camel-optaplanner模块相对较年轻,但是已经过单元测试并且可以工作。
  • Other REST technologies in the Java ecosystem Java生态系统中的其他REST技术

Anyway, OptaPlanner doesn't care how you expose it as a REST service (so it doesn't hinder you either): 无论如何,OptaPlanner不在乎如何将其公开为REST服务(因此也不会妨碍您):

积分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM