net.mossol.bot.service.impl.MessageHandlerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of line_bot_mossol-lib Show documentation
Show all versions of line_bot_mossol-lib Show documentation
Line Bot Mossol (line_bot_mossol-lib)
package net.mossol.bot.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import net.mossol.bot.model.ReplyMessage;
import net.mossol.bot.service.MatcherService;
import net.mossol.bot.service.MessageHandler;
/**
* Created by Amos.Doan.Mac on 2017. 12. 6..
*/
@Service
public class MessageHandlerImpl implements MessageHandler {
private static final Logger logger = LoggerFactory.getLogger(MessageHandlerImpl.class);
@Resource
private List matcherServices;
@Override
public ReplyMessage replyMessage(String requestMessage) throws Exception {
for (MatcherService service : matcherServices) {
ReplyMessage replyMessage = service.match(requestMessage);
if (replyMessage != null) {
return replyMessage;
}
}
logger.info("No matched message");
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy