Server Push With Flex & J2EE: What Is Wrong in Refreshing The Screen?
Server Push With Flex & J2EE: What Is Wrong in Refreshing The Screen?
http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol
TM
Innovate. Execute.
www.eforceglobal.com
Te ch n i c a l W h i t e Pa p e r S e r i e s
Architecture:
Browser
Messaging
Flex
ActionScript Other MXML/AS
App(SWF) Libraries
J2EE Container
Above diagram is the conceptual representation of Server Push Architecture. This means the on client side a set of libraries reside and
talks to Flex Servlet which internally performs the connection between the server and the client open and performs the data push from
server to client without having to perform any client side refresh.
Code:
Here is a scenario where user has a list of tasks which he needs to work on and on run-time he needs to ge notified about any new
task arrivals.
Message publisher in this can tells which all user ids have received a new item in the list of pending tasks to the Flex side action
script components.
Message Publisher:
public static void refreshDashBoard(final String mailids)
{
final MessageBroker msgBroker = MessageBroker.getMessageBroker(null);
final String clientID = UUIDUtils.createUUID(false);
final AsyncMessage msg = new AsyncMessage();
msg.setDestination("feed");
msg.setClientId(clientID);
msg.setMessageId(UUIDUtils.createUUID(false));
msg.setTimestamp(System.currentTimeMillis());
msg.setBody(mailids);
msgBroker.routeMessageToService(msg, null);
}
2
Te ch n i c a l W h i t e Pa p e r S e r i e s