'''Problem''' When you create an application function that updates several artifacts and possibly in multiple systems or data sources, how do you group the changes, in order to: monitor, rollback, audit? '''Context''' Building custom apps, that involve multiple "order" like elements to be updated at the same time. Usually, this would require integration with other systems and putting data into legacy data sources. '''Forces''' * Need to separate one change from another * Need to rollback whole change, or retry process * Need to track and audit all changes as a group * Need to have logical user level representation of an update or transaction that involves multiple elements '''Solution''' Use batch as a linking element. The batch usually includes unique code, date/time of a change, user that initiated the change. Optionally, batch will include information about source and target systems, user notes, attributes such as: [support transactions], [batch type], [fail on single error], [attribute 1], [attribute 2] etc '''Resulting Context''' '''Rationale''' Batches considered old technology and think about attribute of a legacy system. In many cases, we do not need to use batches, since we have technologies like BizTalk and other BPEL bases systems. However, when your process is not close to real-time, there is a need to persist a transaction and what is better way than use batch approach. '''Known Uses''' ETL solutions would be perfect example of the batches. Another example, is batch processing systems; usually legacy systems that would process data nightly and send error report once a day. Batch admins work on batch level. '''Related Patterns''' '''Sketch''' -------------------------------------------------------------------------------- Author(s): Dima Semenskyy Date: 02/01/2005 -------------------------------------------------------------------------------- '''References -------------------------------------------------------------------------------- '''Keywords''': batch -------------------------------------------------------------------------------- '''Example''' ''Order processing system'' Let's say there is a legacy ERP system and there is a need to create e-commerce solution that will be a front-end of an e-store. During the day orders are collected in the front-end system and pushed into the legacy system during night time. Let's say the store sells books - paper and electronic downloads. Business wants to work with paper books and downloads in two different fashions: paper books require to involve shipping department, downloads do not. So, every night front-end will create two types batches: one will contain paper book orders and another one electronic. Single batch will include all orders for a single customer. ETL system that is responsible for moving orders from front-end web site to legacy ERP system will use batches as following: * Use [batch type] to separate paper book orders from downloads and send first to shipping system * Use batch to track order status; assuming that a customer has single address, all orders will have to be shipped to same address - meaning all orders from single batch * Based on customer requirements, all orders may have to be delivered at the same time - again batch will play role of glue * If for some reason we have to cancel all orders (e.g. customer is not eligible), it's real easy to cancel single batch instead of multiple orders.