@Override
public void processReplyTo(MuleEvent event, MuleMessage returnMessage, Object replyTo) throws MuleException
{
AbstractBayeux bayeux = ((BayeuxAware)connector).getBayeux();
Channel channel = bayeux.getChannel(replyTo.toString(), false);
if(channel==null)
{
logger.warn("No ajax Channel: " + replyTo + ". Maybe the client unregistered interest.");
return;
}
Object ret;
if(returnMessage.getExceptionPayload()!=null)
{
//If we are using RPC make sure we still send something back to the client so that the subscription is cancelled
ret = returnMessage.getExceptionPayload().getMessage();
}
else
{
returnMessage.applyTransformers(event, getTransformers());
ret = returnMessage.getPayload();
}
//Publish to interested clients
for (Client client : channel.getSubscribers())
{
channel.publish(client, ret, null);
}
}