Showing posts with label Extension. Show all posts
Showing posts with label Extension. Show all posts

Sunday, January 28, 2018

WSO2 ESB - Sample Class Mediator

In WSO2 ESB / EI when we want to write our own logic of mediation, class mediators are very helpful.

A class mediator can be written by extending AbstractMediator

Following is a sample class mediator which simply logs a sting message (Doesn't actually do any mediation)

This source can be used as a template to start a class mediator quickly

public class SampleClassMediator extends AbstractMediator {

    private static final Log log = LogFactory.getLog(SampleClassMediator.class);

    public boolean mediate(MessageContext messageContext) {
        log.info("This is a sample class mediator");
        return true;
    }
}

Full project can be found in  https://github.com/bsenduran/sample-class-mediator/tree/v1.0