Search in sources :

Example 1 with WonMessageSender

use of won.protocol.message.sender.WonMessageSender in project webofneeds by researchstudio-sat.

the class DelayedDuplicateMessageSenderDecorator method getWonMessageSender.

@Override
public WonMessageSender getWonMessageSender() {
    final WonMessageSender delegate = super.getWonMessageSender();
    return new WonMessageSender() {

        @Override
        public void sendWonMessage(WonMessage message) throws WonMessageSenderException {
            delegate.sendWonMessage(message);
            try {
                Thread.sleep(delay);
            } catch (InterruptedException e) {
                logger.warn("caught while waiting the delay time before sending duplicate message", e);
            }
            delegate.sendWonMessage(message);
        }
    };
}
Also used : WonMessage(won.protocol.message.WonMessage) WonMessageSender(won.protocol.message.sender.WonMessageSender)

Example 2 with WonMessageSender

use of won.protocol.message.sender.WonMessageSender in project webofneeds by researchstudio-sat.

the class DuplicateMessageSenderDecorator method getWonMessageSender.

@Override
public WonMessageSender getWonMessageSender() {
    final WonMessageSender delegate = super.getWonMessageSender();
    return new WonMessageSender() {

        @Override
        public void sendWonMessage(WonMessage message) throws WonMessageSenderException {
            delegate.sendWonMessage(message);
            delegate.sendWonMessage(message);
        }
    };
}
Also used : WonMessage(won.protocol.message.WonMessage) WonMessageSender(won.protocol.message.sender.WonMessageSender)

Aggregations

WonMessage (won.protocol.message.WonMessage)2 WonMessageSender (won.protocol.message.sender.WonMessageSender)2