Foren
Using method without ActionRequest and ActionResponse
practicante practicante, geändert vor 9 Jahren.
Using method without ActionRequest and ActionResponse
Junior Member Beiträge: 47 Beitrittsdatum: 19.07.13 Neueste Beiträge
Hi
I have a method that receive two parameters an object of the type ActionRequest and ActionResponse
something like this
but at this point I donde have any request or any response, can I make my own response and request in the class Calendarizado?
or can I convert some data in request Object?
I have a method that receive two parameters an object of the type ActionRequest and ActionResponse
public void doSomething(ActionRequest, ActionResponse)
{
//logic
}
and works fine, but I want to excute this method in a schedule something like this
public class Calendarizado implements MessageListener{
private static final Log LOGGER = LogFactoryUtil.getLog(Calendarizado.class);
public void receive(Message arg0) throws MessageListenerException {
call doSomething(param, param);
}
}
but at this point I donde have any request or any response, can I make my own response and request in the class Calendarizado?
or can I convert some data in request Object?
Andew Jardine, geändert vor 9 Jahren.
RE: Using method without ActionRequest and ActionResponse
Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
practicante,
I think the MessageListener is the handler for the event -- or more accurately the message placed onto the bus. I think what you are probably looking to do is retrieve the "message data" from the actionRequest in your processAction method, construct a Message object and place it on the bus for it to get to the Listener. If the message contains everything the Listener needs to process, then you shouldn't need the actionRequest in the Listener class. So, something like --
I think the MessageListener is the handler for the event -- or more accurately the message placed onto the bus. I think what you are probably looking to do is retrieve the "message data" from the actionRequest in your processAction method, construct a Message object and place it on the bus for it to get to the Listener. If the message contains everything the Listener needs to process, then you shouldn't need the actionRequest in the Listener class. So, something like --
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse )
{
// build your message to be sent to the listener
Message message = new Message();
message.put("key", ParamUtil.getString(actionRequest, "variable-name");
// place it on the bus
MessageBusUtil.sendSynchronousMessage( <destination>, message);
}
</destination>
Pankaj Kathiriya, geändert vor 9 Jahren.
RE: Using method without ActionRequest and ActionResponse
Liferay Master Beiträge: 722 Beitrittsdatum: 05.08.10 Neueste Beiträge
Scheduler jobs are something thats runs offline(without any browser request which leads request-response life cycle) as per interval defined without any request-response cycle. You cant define or make use of actionRequest or actionResponse in scheduler method.