Java Reference
In-Depth Information
The ReportingMDB has a Spring application context associated with it. It uses the
beans registered in this application context to carry out long-running report generation
tasks. This Spring application context is configured as shown in Listing 5-23.
Listing 5-23. Reporting-beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<bean name="reportServiceProvider"
So far, I have explained the server-side Java components and configuration. Now I
will focus on the client that triggers the asynchronous report processing. Spring provides
the JmsTemplate class to simplify the process of sending JMS messages. It is also based on
the GOF Template Method design pattern. To use this class, you will need to configure it
in the Spring application context and inject the JNDI bound ConnectionFactory and
Destination objects. This is shown in Listing 5-24.
Listing 5-24. insurance-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xsi:schemaLocation="" >
<bean id="qConnectionFactory"
<property name="jndiName" value="ConnectionFactory" />
<property name="jndiEnvironment">
<prop key="java.naming.factory.initial">
Search WWH ::

Custom Search