Tags

We have a class that implements QueueService based on JmsTemplate (Spring)
Method sendMessage sends object to jms queue for future handle by message listeners
The problem is that queue injection should only be happens in case of successful transaction.

We have a method ‘transfer’ in Account service transferd money from one customer account to another acount of same customer.
First, we validate that from account has enough amount of money.
Second, we transfer money.
And at the end we send notification using asyncronus queue email service.

For example: you already have a buisness method that should be extended by adding new functionality. As example we need to change other objects and send different notifications (emails). For this purpose I use next class.Continued…

Drools is a business rule management system (BRMS). It based on rules engine, using an implementation of the Rete algorithm.
Drools supports the JSR-94 standard for its business rule engine and enterprise framework for the construction, maintenance, and enforcement of business policies in an organization, application, or service.
More about Drools is here.

A business process or workflow describes the order in which a series of steps need to be executed, using a flow chart. This makes it much easier to describe a complex composition of various tasks. Processes are especially useful in describing state-based, long-running processes. Drools Flow allows end users to specify, execute and monitor (a part of) their business logic using these processes. The Drools Flow process framework is easily embeddable into any Java application (as a simple Java component) or can run standalone in a server environment.

This article is about practical implementation of rule flow with Spring. In my case flow include validation step at beginning that validates objects, then executes several tasks. Execution of task depends on rules define in flow descriptor. Flow itself defined in flow file (.rf).

Simple flow diagram:

Before flow could execute we need to perform certain action as create session, load flow and validation (.drl) files, setup globals and work items for flow. To simplify controls and manage this action I create integration classes.Continued…