--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Patrik Nordwall
Typesafe - Reactive apps on the JVM
Twitter: @patriknw
Hi,Thanks for your response. I want to query a couchDB using REST. However, i want to put the business logic of doing so in Actors(Akka) instead of Play models. The Actors will perform the request and also receive the response from the database. The Actors can then forward the results to Play Controller.How can i achieve this?
public static Promise<Result> create() throws Exception{
Promise<Result> resultPromise=null;
try {
User user = getRegisteredUser();
DataRequestObject dataRequestObject= new DataRequestObject(new HashMap(), RequestMethod.POST,getClientIpAddr());
Promise<WSResponse> responsePromise = user.save(UserStep.REGISTRATION, DataRepositoryStrategy.CLOUDANT,WS.client(),dataRequestObject);
resultPromise = responsePromise.map(
new Function<WSResponse, Result>() {
@Override
public Result apply(WSResponse response) throws Exception {
ResponseObject responseObject = DBCodesFactory.getResponseObject(response.asJson(), new String[]{"email", user.name.username});
if (responseObject.isSuccess()) {
return ok(views.html.postreg.render());
} else {
flash("error", responseObject.getFailureReason());
return redirect(routes.Users.register());// ok(views.html.register.render());
}
}
});
}catch (Exception d){
Logger.getLogger("NEW REGISTRATION").log(Level.SEVERE, d.toString(), d);
d.printStackTrace();
throw new Exception(d);
}
return resultPromise;
}
On Thursday, April 16, 2015 at 9:07:05 AM UTC+1, Nweike Onwuyali wrote:Hello All,I am a newbie to the Typesafe framework so i might be asking a naive question.I am building a new application using Play and CouchDB as my database. I want to make my connection to the CouchDB a non-blocking operation. Also i want to connect to CouchDB using the JSON API.I will prefer not to use spray-http Marshalling and Unmarshalling support. Will it be appropriate to have Actors receive raw HttpRequest and send message to CouchDB and receive a response using HttpResponse?.I need a guide on how to architect the system.
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.