Monday, July 21, 2014

Sleep/pause/throttle the transaction in OSB

From time-to-time you have requirement to sleep/pause/throttle the transaction in OSB. You can do this by using a simple POJO.

Below is a class to add to your OSBToolkit.java.

public class OSBToolkit
{

    public OSBToolkit()
    {
    }

    public static String sleep(long l)
    {
        String s;
        try
        {
            Thread.sleep(l);
            s = "Success";
        }
        catch(Exception exception)
        {
            s = "Error";
        }
        return s;
    }
}


Then from OSB, reference to the OSBToolkit and the sleep class, specify the following value as input:
xs:long(5000)