There are many ways to have various software components to communicate in Java EE enterprise architecture. The same is applicable for integrating rich Internet Applications written in Adobe Flex and Java EE systems. Let “s consider the following scenario:
An application A is being developed using Flex-BlazeDS-Java, and it needs to integrate with a third-party Java-based Web application B, where the users must register, otherwise they can “t continue using the application A.
Of course, to implement this scenario you can engage some of the business process management software packages that will allow you to describe and configure the workflow with minimum or no coding. But the less moving parts are used in the architecture the better. Here “s the pretty simple way to implement our scenario.
Step 3. In the application A, develop and deploy Java servlet, say RegistrationCompleteServlet that can be called by the application B when the user successfully completed the registration. During this call, the application B will pass to the servlet a Data Transfer Object RegistrationInfoDTO, with all required registration details.
Step 4. The RegistrationCompleteServlet and BlazeDS are collocated in the same Java Servlet container(e..g. GlassFish, Tomcat, et al). The RegistrationCompleteServlet initiates a push of the RegistrationInfoDTO to the BlazeDS destination RegistrationDest with the routing to the proper client. How to push the data to the client over the AMF protocol is described in our book Enterprise Development with Flex.
Step 5. Almost forgot to mention that during the startup, our Flex application has created a Consumer subscribed to the messages from the destination RegistrationDest. As soon as the RegistrationInfoDTO is published to this destination, Flex client will receive it and let the user into the next view with a nice greeting, “Thank you, Yakov for registering. Your credit card information has been validated rdquo;.
That “s ” all there is to it. I “ve included “Part 1 rdquo; in the title of this blog, because hoping that this will become a series of writeups on integrating Flex and Java EE.