Showing posts from June, 2007

Accessing databases in servicemix-drools

ServiceMix provides a Service Engine for Drools, the famous Rules Engine.

People often want to retrieve data from the rules and such data is usually stored in a database. Previously there was no easy way to configure a DataSource and inject it in the rules definitions. This is a small enhancement that I've just written and that will be included in next major release.

So let's say you write your database access code in a simple helper object:
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;

public class DbHelper {
private DataSource dataSource;
private JdbcTemplate jdbcTemplate;

public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
this.jdbcTemplate = new JdbcTemplate(dataSource);

public String getSurname(String name) {
String surname = (String) this.jdbcTemplate
"select surname from t_actor where name …

Loose coupling in JBI

Loose coupling is a feature that can be easily achieved in JBI but which is sometimes not well understood by newbies in the JBI world.

In JBI, services are exposed inside the bus by JBI components when you deploy a given service onto it. These components can be Service Engines (contain business logic) or Binding Components (handling a specific protocol). The distinction is the key for loose coupling: the service itself it decoupled from the protocols used to access it. This is true for all services accessed from inside the JBI bus, be it internal to the bus or external to it.

Let's take an example. You need to write a BPEL process and expose it over SOAP/HTTP, and this process will consume several other services. These services can be inside the JBI bus, accessible via SOAP/HTTP or plain JMS. The important point is that the BPEL process has no knowledge of the protocol and location of these services. How does it work ?

The key is the WSDL. A WSDL can be split into two parts:…

Father for the fifth time

Welcome to this world, Alexandre! My new son was born on May the 30th, weights 3.8 kg and his height is 52 cm.