I was trying to implement this. 
http://www.playframework.com/documentation/2.2.x/JavaAkka
Marked in orange is the line where i was trying to return the Future 
message to my controller from the actor.
But the problem is am not receiving the message and i am getting timeout in 
the controller.

*This is my stack trace.*

[INFO] [02/14/2014 12:33:29.848] 
[application-akka.actor.default-dispatcher-7] 
[akka://application/deadLetters] Message 
[jaxb.ota.OTAHotelBookingRuleNotifRQ] from 
Actor[akka://application/deadLetters] to 
Actor[akka://application/deadLetters] was not delivered. [1] dead letters 
encountered. This logging can be turned off or adjusted with configuration 
settings 'akka.log-dead-letters' and 
'akka.log-dead-letters-during-shutdown'.
[error] play - Cannot invoke the action, eventually got an error: 
akka.pattern.AskTimeoutException: Timed out
[error] application - 

Can some one please help me on this?

*I have this peace of code in my controller.*
private static ActorSelection serviceContollerActor = 
Akka.system().actorSelection(
      "akka://application/user/" + 
ActorName.SERVICE_CONTROLLER_ACTOR.toString());
public static Result valueAdd() {

    Document dom = request().body().asXml();

    if (dom == null) {
      return badRequest("Expecting Xml data");
    } else {
      
      Timeout timeout = new Timeout(FiniteDuration.create(20, SECONDS));
      return async(Promise.wrap(
          ask(serviceContollerActor,
              new ControllerMessage(JagatServiceAction.VALUE_ADD_SERVICE, 
Optional.fromNullable(dom), Util
                  .getUUID()), timeout)).map(new Function<Object, Result>() 
{
        @Override
        public Result apply(Object response) throws Throwable {
          return ok(response.toString());
        }
      }));
    }
  }

*And onReceive of my actor looks something like*

public void onReceive(Object message) throws Exception {
    final ExecutionContext ec = context().system().dispatcher();
    if (message instanceof ControllerMessage) {
      final ControllerMessage controllerMessage = (ControllerMessage) 
message;
      Logger.debug("Service Controller message :" + 
controllerMessage.getAction() + " Sender :" + getSender());
      switch (controllerMessage.getAction()) {
        case VALUE_ADD_SERVICE:
          final Future<OTAHotelBookingRuleNotifRQ> f = future(new 
Callable<OTAHotelBookingRuleNotifRQ>() {
            @Override
            public OTAHotelBookingRuleNotifRQ call() throws Exception {
              Logger.debug("Inside---------");
              final Document dom = (Document) 
controllerMessage.getData().get();
              OTAHotelBookingRuleNotifRQ request = new 
OTAHotelBookingRuleNotifRQ();
              request = 
RequestUnmarshallingUtil.unmarshalOTAHotelBookingRuleNotifRQ(dom, request);
              return request;
            }
          }, ec);

          f.onSuccess(new OnSuccess<OTAHotelBookingRuleNotifRQ>() {
            @Override
            public void onSuccess(OTAHotelBookingRuleNotifRQ response) 
throws Throwable {
              if (response != null) {
                Logger.debug("Inside on success -" + response.toString());
                //akka.pattern.Patterns.pipe(f, 
ec).to(getContext().sender());
                /*getContext().sender().tell(
                    new 
ControllerMessage(JagatServiceAction.SERVICE_CONTROLLER, 
Optional.fromNullable(response),
                        JagatServiceUtil.getUUID()), 
getContext().sender());*/
*                getSender().tell(response,getContext().sender());*
              }
            }

          }, ec);
          
          f.onFailure(new OnFailure() {
            @Override
            public void onFailure(Throwable throwable) throws Throwable {
              Logger.error("Google Posting failed. Sendind this request to 
Queue..", throwable);
              controllerMessage.setError((Exception)throwable);
            }
          }, ec);   

        default:
          unhandled(message);
          break;
      }
    }

  }

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to