Business Use Case for the JMS Binding Example
The JMS Binding example shows how to connect the JMS bindings to a simple service component inside ServiceMix.
A hypothetical business scenario, which encompasses the JMS Binding example, is that of a web application making a request for a Tax ID Number (TIN). This example is based on a web-based Tax ID Application form, in which a user enters data, such as first and last name, date of birth, and place of birth. The web Tax ID Applicatoin form sends the request to the "JMSServlet" servlet. The servlet publishes the request on the JMS submission topic. The applicationFormReceiver, which is a JMS Binding component that subscribes to the submission topic, receives the request. The applicationFormReceiver sends the data to the formProcessor via the Normalized Message Router (NMR). The formProcessor is a service engine that assigns the appropriate TIN to the user. The formProcessor then publishes the response to the result topic. A Message Driven Bean (MDB) then subscribes to the result topic, receives the response message, updates the Tax ID database with the new TIN, and notifies the user that the request has been fulfilled. The user can then check the database to get the requested TIN.
The steps below detail the workflow outlined above:
- The user fills in the web Tax ID application form, entering data such as first and last name, date of birth, and place of birth, etc.
- The web form submits the request to a servlet running in an application server.
- The JMSServlet creates a record for the submitter in a database table. Let's say the table contains a RECORD ID, USERNAME and TAXID fields.
- The servlet then responds to the user with a page that has a message and a link. The message says, "Check your email for a message that will contain a link for checking TIN status." It also sends an email to the person with a link that says "Click here to retrieve your record." The link contains the record ID and points to a JSP or servlet that can retrieve the user's record. Initially the TAXID field will say "PENDING".
- The JMSServlet then publishes the request to the submission topic.
- The applicationFormReceiver, which is a JMS Binding component that subscribes to the submission topic, receives the request.
- The applicationFormReceiver creates a normalized message and sends it to the formProcessor via the NMR.
- The formProcessor assigns the appropriate TIN to the user. The formProcessor then publishes the response to the result topic.
- A MDB is also running in the same application server as the servlet. The MDB is listening on the Result topic for the result from the formProcessor.
- When the MDB reads the TIN, it updates the user's record in the database.
- Now, when the user clicks the link, the TAXID field will have the TIN and it will no longer say, "PENDING"
The diagram below illustrates the process described above: