Batch mode

Sometimes an application needs to generate content outside of an HTTP request operation. For example an e-commerce application has to sent marketing emails to its customers twice per day, or a financial system will have to provide PDF files with account monthly statement operations to its customers at the end of each month.

Webpagebytes CMS supports this feature through the batch mode functionality.

An application that integrates Webpagebytes CMS and wants to support batch mode will have to register its own ServletContextListener in the web servlet container. Once the code from the application ServletContextListener is executed, content can be fetched from the CMS with the WPBContentService interface.

It is important to mention that before any application own implemented ServletContextListener declaration in the application web.xml file, the Webpagebytes CMS context listener (implemented by com.webpagebytes.cms.WPBCmsContextListener) needs to be declared. This will allow the CMS engine to do all the preparation and initialization work.

Make sure that com.webpagebytes.cms.WPBCmsContextListener context listener is specified as the first context listener in the web.xml file.

Webpagebytes CMS sample application comes with the following web.xml, see the order of the servlet context listeners.

An application that supports batch mode will adopt the following logic in the ServletContextListener implementation code

Webpagebytes CMS Demo application implements the support for batch mode. Using Quartz Scheduler it sends each day at midnight an email report with a dynamic pdf generated to a configured email address. Please see the demo application code for more details.