简体   繁体   中英

Create Service broker for Play Framework Api

I have created a sample play framework api which has one endpoint.

http://play-demo-broker.cfapps.io/say?number=20 Which just return me number that have passed.

I am able successfully deploy the service. Next want this service to Act like service broker For same want to register this as by using below command

 cf create-service-broker play-demo-broker admin admin http://play-demo-broker.cfapps.io --space-scoped

This command it giving me below error -

The service broker rejected the request. Status Code: 404 Not Found

Not sure what is causing this issue as there not much information available for Play Framework Service broker Setup.

The play framework is implemented above the akka packages. Akka rejects paths that are not implemented.

If I an not mistaken, cf create-service-broker command access the / endpoint. If you implemented only say?number=20 endpoint, then be default all other paths, such as the empty path, are rejected by Akka.

In order to open that endpoint you need to add it into the routes. For example you can add:

GET     /            controllers.ControllerName.GetEmptyPath

And implement the GetEmptyPath method in ControllerName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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